Java Collection Unique getUnique(Collection c)

Here you can find the source of getUnique(Collection c)

Description

get Unique

License

Apache License

Declaration

public static <T> T getUnique(Collection<T> c) 

Method Source Code

//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();
        }
    }
}

Related

  1. addUnique(C collection, T item)
  2. addUnique(final Collection collection, final Object value)
  3. generateUniqueName(String aName, Collection aStringCollection)
  4. getUnique(Collection collection)
  5. getUniqueName(String name, Collection collection)
  6. getUniqueNameWithNumbers(Collection names, String baseName)
  7. getUniqueValue(Collection values, String initValue)