Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to identify duplicate values in arraylist

Answers were Sorted based on User's Feedback



how to identify duplicate values in arraylist..

Answer / shrinu nallavelli

arrayList elements are differentiated by their index values
onlu..

Is This Answer Correct ?    3 Yes 3 No

how to identify duplicate values in arraylist..

Answer / srikanth m

List<String> list = new ArrayList<String>();
list.add("abc");
list.add("def");
list.add("abc");




HashMap<String, Integer> map = new HashMap<String, Integer>();




for (String str : list) {
Integer c = (Integer) map.get(str);
if (c == null || c == 0) {
map.put(str, 1);
} else {
map.put(str, ++c);
}
}
System.out.println(map);

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is instance synchronization?

0 Answers  


Is nullpointerexception checked or unchecked?

0 Answers  


what is difference between validation.xml & validation rules.xml?

8 Answers   BirlaSoft,


Which variable is the independent variable?

0 Answers  


How many bits is a string in java?

0 Answers  


In Java list the methods that can be overridden?

0 Answers   Accenture,


What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?

0 Answers  


What is double parsedouble in java?

0 Answers  


What is subsequence of a string?

0 Answers  


Distinguish between a predicate and a function?

0 Answers  


What do you mean by checked exceptions?

0 Answers  


What is the life-cycle of an object?

2 Answers   Broadridge, Syntel,


Categories