Java Utililty Methods List Select

List of utility methods to do List Select

  1. HOME
  2. Java
  3. L
  4. List Select

Description

The list of methods to do List Select are organized into topic(s).

Method

List select(List list, List indices, List sel)
select
Iterator<Integer> itIndex = indices.iterator();
if (!itIndex.hasNext()) {
 return sel;
int desiredIndex = itIndex.next().intValue();
int currIndex = 0;
for (E elem : list) {
 if (currIndex == desiredIndex) {
...
List select(List src, List indexes)
select
List<T> result = new ArrayList<T>();
for (Integer index : indexes) {
 result.add(src.get(index));
return result;
Collection selectDuplicateQualifiers(List elements)
select Duplicate Qualifiers
Set<T> result = null;
for (T nextQualifier : elements) {
 if (Collections.frequency(elements, nextQualifier) > 1) {
 if (result == null) {
 result = new HashSet<T>(2);
 result.add(nextQualifier);
return (result != null) ? result : Collections.<T>emptySet();
List selectElements(final List list, int start, int end)
select Elements
if (list.size() == 0 || !(0 <= start && end < list.size()))
 return null;
final List<String> newList = new ArrayList<String>();
for (int index = start; index <= end; index++)
 newList.add(String.valueOf(list.get(index)));
return newList;
Collection> selectExactly(List original, int nb)
select Exactly
if (nb < 0) {
 throw new IllegalArgumentException();
if (nb == 0) {
 return Collections.emptyList();
if (nb == 1) {
 final List<List<E>> result = new ArrayList<List<E>>();
...
String selectFields(String[] fields, List fieldList, int allFieldsFrom, String separator)
select Fields
String retv = null;
int i = 0;
StringBuffer sb = null;
if (fieldList != null && fieldList.size() > 0) {
 if (sb == null) {
 sb = new StringBuffer();
 for (Integer index : fieldList) {
...
T selectRandom(List list)
select Random
int index = (int) (Math.random() * list.size());
return list.get(index);
ArrayList selectTopN(List originalList, int topN, Comparator comparator)
Pick the top N items from the specified list.
ArrayList<Object> newList = new ArrayList<Object>(topN);
int numIncluded = 0;
Object lastObject = null;
for (Object o : originalList) {
 if (numIncluded < topN) {
 newList.add(o);
 if (comparator.compare(o, lastObject) != 0) {
 numIncluded++;
...


AltStyle によって変換されたページ (->オリジナル) /