List of utility methods to do List Rotate
void | rotate(final List Rotate a list by N places. final int len = list.size(); if (len <= 0 || n == 0) return; n %= len; if (n > 0) { for (; n > 0; n--) { T t = list.remove(0); list.add(t); ... |
void | rotate(List rotate if (a.size() > 0) {
Object tmp = a.remove(0);
a.add(tmp);
|
List | rotate(List rotate List<T> result = new ArrayList<>(); int len = n % data.size() + ((n < 0) ? data.size() : 0); for (int i = 0; i < len; i++) result.add(data.get(data.size() + i - len)); for (int i = len; i < data.size(); i++) result.add(data.get(i - len)); return result; |
List
| rotateRowsOfMatrix(List
rotate Rows Of Matrix List<List<Integer>> result = new ArrayList<List<Integer>>(); for (int i = 0; i < matrix.size(); i++) { List<Integer> row = matrix.get(i); List<Integer> newRow = new ArrayList<Integer>(); Integer temp0 = row.get(0); Integer temp1 = row.get(1); Integer temp2 = row.get(2); Integer temp3 = row.get(3); ... |