Java Utililty Methods List First Item

List of utility methods to do List First Item

Description

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

Method

TremoveFirst(List list)
Remove the first element in the list.
return list.remove(0);
TremoveFirstElement(List l)
Removes and returns the element at index 0, or null if the List is empty.
if (l.isEmpty()) {
    return null;
return l.remove(0);
ListremoveFirstHalfElements(final List list)
remove First Half Elements
if (list.size() < 2) {
    return list;
return list.subList(list.size() / 2 - 1, list.size());
Stringreplace(int codePoint, int firstCharacterInGroup, List referenceList)
replace
int relative = codePoint - firstCharacterInGroup;
int taget = relative % referenceList.size();
return referenceList.get(taget);
voidswap(List list, int firstIndex, int secondIndex)
Swaps the two rows.
Object backup;
backup = list.get(firstIndex);
list.set(firstIndex, list.get(secondIndex));
list.set(secondIndex, backup);