PLUG-IN to verify duplicate values in the ArrayList object

05 Mar

Hi folks,

Here we go implemented a PLUG-IN to verify the duplicate values exists in the given ArrayList object or not.

Hope this code will save developers time for some extent.

class CheckDupliateValue {
public static void main(String[] args) {
ArrayList arr = new ArrayList();
boolean isDupExits = checkDuplicateValue(arr);
if (isDupExits) {
System.out.println(” << Yes Duplicate Values Exists >> “);

public static boolean checkDuplicateValue(ArrayList list) {
HashSet set = new HashSet();
for (int i = 0; i < list.size(); i++) {
boolean val = set.add(list.get(i));
if (val == false) {
return val;
return true;

Happy Coding!.

Get glued to know more updates.

Have a nice day:-)


Leave a comment

Posted by on March 5, 2013 in Uncategorized


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: