Get Size of Java LinkedHashSet : LinkedHashSet « Collections Data Structure « Java

Get Size of Java LinkedHashSet


import java.util.LinkedHashSet;

public class Main {

  public static void main(String[] args) {
    LinkedHashSet<Integer> lhashSet = new LinkedHashSet<Integer>();

    System.out.println("Size of LinkedHashSet : " + lhashSet.size());
    lhashSet.add(new Integer("1"));
    lhashSet.add(new Integer("2"));
    lhashSet.add(new Integer("3"));


    lhashSet.remove(new Integer("1"));



Related examples in the same category

1.Iterate through elements of Java LinkedHashSet
2.Remove all elements from Java LinkedHashSet
3.Remove specified element from Java LinkedHashSet
4.Simple Java LinkedHashSet
5.Creating a Set That Retains Order-of-Insertion