Android examples for java.util:Set
Generic method to create Set from array
//package com.book2s; import java.util.HashSet; import java.util.Set; public class Main { public static <T> Set<T> toUniqueSet(T[] array) { HashSet<T> set = new HashSet<T>(); if (array != null) { for (T object : array) { if (!set.contains(object)) { set.add(object);/*from w w w .ja va2 s.co m*/ } } } return set; } }