Merge pull request #24 from Frostman/arrays_kt_fix

Arrays.copyOf() and .copyOfRange() should return not nullable result
This commit is contained in:
James Strachan
2012-03-17 09:15:48 -07:00
2 changed files with 58 additions and 16 deletions
+16 -16
View File
@@ -75,25 +75,25 @@ inline fun FloatArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fr
inline fun DoubleArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fromIndex, toIndex)
inline fun CharArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fromIndex, toIndex)
inline fun BooleanArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength)
inline fun ByteArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength)
inline fun ShortArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength)
inline fun IntArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength)
inline fun LongArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength)
inline fun FloatArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength)
inline fun DoubleArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength)
inline fun CharArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength)
inline fun BooleanArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure()
inline fun ByteArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure()
inline fun ShortArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure()
inline fun IntArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure()
inline fun LongArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure()
inline fun FloatArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure()
inline fun DoubleArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure()
inline fun CharArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure()
inline fun <T> Array<T>.copyOf(newLength: Int = this.size) : Array<T> = Arrays.copyOf(this, newLength).sure()
inline fun BooleanArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to)
inline fun ByteArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to)
inline fun ShortArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to)
inline fun IntArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to)
inline fun LongArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to)
inline fun FloatArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to)
inline fun DoubleArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to)
inline fun CharArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to)
inline fun BooleanArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure()
inline fun ByteArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure()
inline fun ShortArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure()
inline fun IntArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure()
inline fun LongArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure()
inline fun FloatArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure()
inline fun DoubleArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure()
inline fun CharArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure()
inline fun <T> Array<T>.copyOfRange(from: Int, to: Int) : Array<T> = Arrays.copyOfRange(this, from, to).sure()