class Vertex implements Comparable<Vertex>
{
public final String name;
public Edge[] adjacencies;
public double minDistance = Double.POSITIVE_INFINITY;
public Vertex previous;
...
Type: Posts; User: xJavaLover
class Vertex implements Comparable<Vertex>
{
public final String name;
public Edge[] adjacencies;
public double minDistance = Double.POSITIVE_INFINITY;
public Vertex previous;
...
if (collection[i].getTitle().compareTo(collection[j].getTitle())>0)
is where the null error is occuring.
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,...
I see what you're saying...how can I sort it without sorting...if I swap values it is sorting...
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...
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...
public class Searching
{
public static Comparable linearSearch (Comparable[] list, Comparable target)
{
int index = 0;
boolean found = false;
while (!found && index <...
Ya lost me...lol...so the loop method should work for my application...I don't know how I would go about implementing that.
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...
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...
I added this
public String toString()
{
if (shipment == null)
return "shipment is null";
else{
String s = "ALL PACKETS \n";
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...
what will I be printing in...string s, int id, double d? in the array loop?
for(Packet mypacket : shipment)
It says, java.lang.NullPointerException
at Packages.toString(Packages.java:78)
at java.lang.String.valueOf(String.java:2854)
at...
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)
...