Here you can find the source of getArbitraryMember(Collection
static public <T> T getArbitraryMember(Collection<T> s)
//package com.java2s; /******************************************************************************* * SiniaUtils// w ww . j ava2s .c o m * Copyright (c) 2011-2 Siniatech Ltd * http://www.siniatech.com/products/siniautils * * All rights reserved. This project and the accompanying materials are made * available under the terms of the MIT License which can be found in the root * of the project, and at http://www.opensource.org/licenses/mit-license.php * ******************************************************************************/ import java.util.Collection; public class Main { static public <T> T getArbitraryMember(Collection<T> s) { return s.isEmpty() ? null : s.iterator().next(); } }