This commit is contained in:
Jesper Wilhelmsson 2018-02-01 02:05:35 +01:00
commit c2735a15d7
26 changed files with 7676 additions and 143 deletions

View file

@ -1143,6 +1143,23 @@ public class ArrayList<E> extends AbstractList<E>
return modified;
}
public Object[] toArray() {
checkForComodification();
return Arrays.copyOfRange(root.elementData, offset, offset + size);
}
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
checkForComodification();
if (a.length < size)
return (T[]) Arrays.copyOfRange(
root.elementData, offset, offset + size, a.getClass());
System.arraycopy(root.elementData, offset, a, 0, size);
if (a.length > size)
a[size] = null;
return a;
}
public Iterator<E> iterator() {
return listIterator();
}

View file

@ -116,8 +116,8 @@ public class Base64 {
*
* @param lineLength
* the length of each output line (rounded down to nearest multiple
* of 4). If {@code lineLength <= 0} the output will not be separated
* in lines
* of 4). If the rounded down line length is not a positive value,
* the output will not be separated in lines
* @param lineSeparator
* the line separator for each output line
*
@ -135,10 +135,12 @@ public class Base64 {
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
// round down to nearest multiple of 4
lineLength &= ~0b11;
if (lineLength <= 0) {
return Encoder.RFC4648;
}
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
return new Encoder(false, lineSeparator, lineLength, true);
}
/**