0

I have looked around few examples and cant get my head around it.

I have an List of object and there are some duplicate IDs(strings) in some of those object. What i am trying to do is to go through that list, pick IDs and remove object with duplicate ID and only keep one of them I am feeling rather dump at the moment.

1
  • 1
    Thought of trying a HashMap? Commented Oct 28, 2014 at 15:12

1 Answer 1

2

You could try this:

List<String> list;
List<String> newList = new ArrayList<String>(new LinkedHashSet<String>(list));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.