Java tutorial
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <V> List<V> getOddIndexedValuesFrom(Collection<V> arg) { if (null == arg || arg.isEmpty()) { return Collections.EMPTY_LIST; } return getIndexedValuesFrom(arg, 1); } private static <V> List<V> getIndexedValuesFrom(Collection<V> arg, int initial) { if (null == arg || arg.isEmpty()) { return Collections.EMPTY_LIST; } List<V> indexed = new ArrayList<V>(); for (V each : arg) { initial++; if (initial % 2 == 0) { continue; } indexed.add(each); } return indexed; } }