LinkedHashSet in Java ( Example and Methods) - Java2021 : Online Tutorials Hub

Java2021 : Online Tutorials Hub

JAVA | Advance Java | MySQL | Data Structure | Git | HTML | CSS | JS

Latest

Post Top Ad

Sunday, April 26, 2020

LinkedHashSet in Java ( Example and Methods)

Methods of Linked Hash Set with Example
package Practice;
import java.util.Iterator;
import java.util.LinkedHashSet;
public class LinkedHashSetExample {
    public static void main(String[] args) {
        LinkedHashSet l=new LinkedHashSet();
        l.add("Ravi");
        l.add("Kumar");
        l.add("Sagar");
        System.out.println(l);
        l.remove("Sagar");
        System.out.println(l.size());
        System.out.println(l.removeAll(l));

        Iterator it=l.iterator();
        while (it.hasNext()){
        System.out.println(it.next());
        }
    }
}


Sorting and Searching Programs
Start with your Choice
-Important Programs for Freshers
Learn Pattern Programs 
Click to learn Array Programs
Click to Learn MySQL 
for any complaint regarding my Blog please visit contact us page and write what problem you have!
Learn with us | HTML | CSS | JS | Bootstrap | JAVA | ADV JAVA | MySQL | GIT

No comments:

Pages