in.ashwanthkumar.utils.collections.Sets Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of my-java-utils Show documentation
Show all versions of my-java-utils Show documentation
My personal set of utils that I take along with my java projects.
package in.ashwanthkumar.utils.collections;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public class Sets {
public static Set of(T... elements) {
Set set = new HashSet();
Collections.addAll(set, elements);
return set;
}
public static Set copy(Set input) {
HashSet copy = new HashSet();
copy.addAll(input);
return copy;
}
public static boolean isEmpty(Set set) {
return set == null || set.isEmpty();
}
public static boolean nonEmpty(Set set) {
return !isEmpty(set);
}
}