Add elements in LinkedHashSet
- 11th Sep 2018
- 0
- 4931
- Add elements in LinkedHashSet how to add collection to linkedhashset in java how to add elements in linkedhashset in java linkedhashset add and addall in java
We can use add() method of LinkedHashSet to add elements to LinkedHashSet collection boolean add(Object obj) It adds the element obj to the Set. Example import java.util.*; public class LinkedHashSetAddExample { public static void main(String args[]) { LinkedHashSet<String> lhs = new LinkedHashSet<String>(); lhs.add("java"); lhs.add("c"); lhs.add("c++"); System.out.println(lhs); } } import java.util.*; public class LinkedHashSetAddExample […]