I want to get random keys and their respective values from a Map. The idea is that a random generator would pick a key and display that value. The tricky part is that both k
In some cases you might want to preserve an order you put the elements in the Set,
In such scenario you can use, This
Set alldocsId = new HashSet<>();
for (int i=0;i alldocIDlst = new ArrayList<>();
Iterator it = alldocsId.iterator();
while (it.hasNext())
{
alldocIDlst.add(Integer.valueOf(it.next().toString()));
}