Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: REMOVE DUPLICATE ELEMENTS

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default REMOVE DUPLICATE ELEMENTS

    Write a program to remove duplicate elements from array list........


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: REMOVE DUPLICATE ELEMENTS

    Do you have any specific questions about your assignment?
    Please post your code and any questions about problems you are having.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: REMOVE DUPLICATE ELEMENTS

    i have array
    int array[] = {1,2,1,3,4,5,2,3,4,5};
    i want to remove duplicates from this array by usin simple java code without using any math rule like HASH. etc

    output int this form...

    {1,2,3,4,5}

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: REMOVE DUPLICATE ELEMENTS

    Ok. What ideas do you have about how to remove the duplicates? You'll need to use some loops to scan through the array to look at each element.
    At some time you'll need to create a new array that is the size of the unique elements and copy the unique elements to it.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Adding add/remove button to add/remove tab
    By JMtrasfiero in forum What's Wrong With My Code?
    Replies: 6
    Last Post: March 27th, 2012, 11:24 AM
  2. To remove duplicate values from 2 big files
    By tcstcs in forum Java Theory & Questions
    Replies: 6
    Last Post: March 1st, 2012, 07:12 PM
  3. [SOLVED] Looping through ArrayList to remove elements
    By itispj in forum Collections and Generics
    Replies: 3
    Last Post: October 14th, 2011, 12:42 AM
  4. [SOLVED] ArrayList object's elements confusing??? doesnt replace the elements? set() method?
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: June 21st, 2011, 01:20 PM
  5. Duplicate elements in 2 Arraylist
    By tcstcs in forum Collections and Generics
    Replies: 3
    Last Post: April 18th, 2011, 12:56 AM