by
0
8
3,067
1
Top 1% !
Popular
Famous
Tagged
Easy-to-find
Specified
Refined
MultiPlatform
Popularity: 4533rd place
ClassNameHashSetGenerator
InputName0args
InputType0String[]
Languagejava
LicenseMIT_X11
MethodNamemain
OutputTypevoid

How to create a Set<T> map in java

This simple snippet shows how to instantiate a HashSet<T> map
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/471795/How-to-create-a-Set-T--map-in-java?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
import java.util.*; public class HashSetGenerator { public static void main(String[] args) { Set<String> s = new HashSet<String>(); for (String a : args) s.add(a); System.out.println(s.size() + " contains words: " + s); } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus