DEV Community

V I N O T H
V I N O T H

Posted on

1 1 1 1 1

HashSet removing duplication in java

package framework;

import java.util.HashSet;
import java.util.LinkedHashSet;

public class String_arry_list {
public static void main(String[] args) {
    String name="neelakanadan";
    LinkedHashSet al=   new LinkedHashSet();    
    for(int i=0;i<name.length();i++)
    {
        boolean add=al.add(name.charAt(i));
        if(add==false) 
        {
            System.out.println(name.charAt(i));
        }
    }System.out.println(al);
}
}

Enter fullscreen mode Exit fullscreen mode

output

e
a
n
a
a
n
[n, e, l, a, k, d]

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Datadog

Keep your GPUs in check

This cheatsheet shows how to use Datadog’s NVIDIA DCGM and Triton integrations to track GPU health, resource usage, and model performance—helping you optimize AI workloads and avoid hardware bottlenecks.

Get the Cheatsheet

👋 Kindness is contagious

Value this insightful article and join the thriving DEV Community. Developers of every skill level are encouraged to contribute and expand our collective knowledge.

A simple “thank you” can uplift someone’s spirits. Leave your appreciation in the comments!

On DEV, exchanging expertise lightens our path and reinforces our bonds. Enjoyed the read? A quick note of thanks to the author means a lot.

Okay