Search:

Type: Posts; User: xJavaLover

Search: Search took 0.12 seconds.

  1. Replies
    0
    Views
    940

    Efficiency of this snippet?

    class Vertex implements Comparable<Vertex>
    {
    public final String name;
    public Edge[] adjacencies;
    public double minDistance = Double.POSITIVE_INFINITY;
    public Vertex previous;
    ...
  2. Replies
    5
    Views
    1,123

    Re: Sorting Array & Binary Search Help

    if (collection[i].getTitle().compareTo(collection[j].getTitle())>0)

    is where the null error is occuring.
  3. Replies
    5
    Views
    1,123

    Re: Sorting Array & Binary Search Help

    Anyone wanna help me figure out how to sort this array of collection objects?

    I am trying to sort it using a loop. I currently recieve a null exception.


    public void addDVD (String title,...
  4. Replies
    5
    Views
    1,123

    Re: Sorting Array & Binary Search Help

    I see what you're saying...how can I sort it without sorting...if I swap values it is sorting...
  5. Replies
    5
    Views
    1,123

    Sorting Array & Binary Search Help

    I am trying to sort my array of DVDs without using a sorting algorithm. This works with 4 or so DVDs but displays error java.lang.ArrayIndexOutOfBoundsException: 4 with anymore added.

    I don't know...
  6. Replies
    7
    Views
    1,481

    Re: Linear Search / Index Location of Strings

    I understand what you're saying...I used that call...I kept my loop...I know I have to change the type because String target wont work with an integer (threw an error) I don't know how I can look for...
  7. Replies
    7
    Views
    1,481

    Re: Linear Search / Index Location of Strings

    public class Searching
    {
    public static Comparable linearSearch (Comparable[] list, Comparable target)
    {
    int index = 0;
    boolean found = false;

    while (!found && index <...
  8. Replies
    7
    Views
    1,481

    Re: Linear Search / Index Location of Strings

    Ya lost me...lol...so the loop method should work for my application...I don't know how I would go about implementing that.
  9. Replies
    7
    Views
    1,481

    Linear Search / Index Location of Strings

    I have an array and in this array it contains strings like so:



    Contact[] guys = new Contact[8];

    guys[0] = new Contact ("Rob", "Smith", "610-555-7384");


    This is just an example of...
  10. Replies
    11
    Views
    1,472

    Re: Need some help getting this code to run...

    OK I figured it out...my array now prints the input file.

    BUT my methods (displayHeavyWeight, displayLightWeight...etc) are not being displayed or called I believe...how do I go about implementing...
  11. Replies
    11
    Views
    1,472

    Re: Need some help getting this code to run...

    I added this



    public String toString()
    {
    if (shipment == null)
    return "shipment is null";
    else{
    String s = "ALL PACKETS \n";
  12. Replies
    11
    Views
    1,472

    Re: Need some help getting this code to run...

    I got the code to compile and run but it only outputs "ALL PACKETS" text...I don't know what's going on.



    public class Packet extends Packages
    {
    // instance variables - replace the...
  13. Replies
    11
    Views
    1,472

    Re: Need some help getting this code to run...

    what will I be printing in...string s, int id, double d? in the array loop?
  14. Replies
    11
    Views
    1,472

    Re: Need some help getting this code to run...

    for(Packet mypacket : shipment)

    It says, java.lang.NullPointerException
    at Packages.toString(Packages.java:78)
    at java.lang.String.valueOf(String.java:2854)
    at...
  15. Replies
    11
    Views
    1,472

    Need some help getting this code to run...

    I compiled my code but it will not output. I get an error that points to



    public String toString()
    {
    String s= "ALL PACKETS \n";
    for(Packet mypacket : shipment)
    ...
Results 1 to 15 of 15