Results 1 to 2 of 2
  1. #1
    heys is offline Member
    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0

    Default printing with count on linkedlist-JAVA error correcting

    private void displayFlowers() {

    int count = 0;

    if(start == null) { System.out.println("\n List is empty !!"); } else { Node tail = start;

    while(tail!= null) {keep boolean[] counted= new boolean[getName.length];2 for(int i=0;i<name.length;i++)2 { boolean isUnique = false;2 and 1 if(!counted[i]) {isUnique=true; count=1; counted[i]=true; for(int j=i+1;j<name.lenght;j++) {if(name[i]==(name[j])) {count++; counted[j]=true;} } } if(isUnique) {System.out.println(name[i]+"- "+count+"\n");}}} boolean isDistinct=false;1 Node name=start;1

    while(name!=tail){1 /* Node prev=tail.getnext; while( tail.hasNext()) ; if(name==prev)

    Next=tail.next(); if(prev==next); dups++; previous=next;*/ /* if(name.equals.tail.getNext());1 1 name=+count;1} else{1 isDistinct|=!name.getItem().equals(tail.getNext()) ;1 isDistinct=true; name=name.getNext();}1 System.out.println("name" +isDistinct);/I don't think that this is correct.1 REMOVE if(isDistinct)isDistinct++;1*/ KEEP IF DOESN"T WORK tail=tail.getNext();} System.out.println("Flower number("+count+") , node value="+tail.getItem().getName()+"\tFlower Color "+tail.getItem().getColor()+"\tHas Thorns " +tail.getItem().isThorns()+"\tSmell: "+tail.getItem().getSmell()); count++; * tail /= tail.getNext();

    }}}I have a linked list and I am trying to print how many from each node I have...For example..If I have entered the item Fries 5 times I would like for it to print 5-Fries in my code. The printing portion is the only thing I am needing help with.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: printing with count on linkedlist-JAVA error correcting

    Please go through the Forum Rules, particularly the second paragraph.

    db

    THREAD CLOSED as a duplicate of http://www.java-forums.org/new-java/...list-java.html
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 8
    Last Post: 07-26-2013, 07:04 PM
  2. count every 45 records and prfix the count number
    By dkr786 in forum New To Java
    Replies: 8
    Last Post: 02-15-2013, 07:31 PM
  3. Help with deleting/printing linkedlist<object>
    By delvinv in forum New To Java
    Replies: 3
    Last Post: 05-02-2012, 09:43 AM
  4. Replies: 18
    Last Post: 08-09-2011, 08:08 AM
  5. Replies: 5
    Last Post: 11-22-2008, 01:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •