Here you can find the source of getUnique(Collection
public static <T> T getUnique(Collection<T> c)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static <T> T getUnique(Collection<T> c) { if (c.isEmpty()) { return null; } else {/*from www. j a v a 2 s. com*/ return c.iterator().next(); } } }