This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "accountIDVStatus":"PASS", | |
| "creditReportInfo":{ | |
| "score":547, | |
| "scoreBand":4, | |
| "clientRef":"CS-SED-655426-708782", | |
| "status":"MATCH", | |
| "maxScoreValue":700, | |
| "minScoreValue":0, | |
| "monthsSinceLastDefaulted":-1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Copy using arraycopy | |
| fun catTwoIntArrays1(array1 :IntArray, array2 :IntArray) : IntArray { | |
| val newArray = IntArray(array1.size + array2.size) | |
| System.arraycopy(array1, 0, newArray, 0 , array1.size) | |
| System.arraycopy(array2, 0, newArray, array1.size , array2.size) | |
| return newArray | |
| } | |
| //Copy using for loops | |
| fun catTwoIntArrays2(array1 :IntArray, array2 :IntArray) : IntArray { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Copy using arraycopy | |
| fun catTwoIntArrays1(array1 :IntArray, array2 :IntArray) : IntArray { | |
| val newArray = IntArray(array1.size + array2.size) | |
| System.arraycopy(array1, 0, newArray, 0 , array1.size) | |
| System.arraycopy(array2, 0, newArray, array1.size , array2.size) | |
| return newArray | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Copy using for loops | |
| fun catTwoIntArrays2(array1 :IntArray, array2 :IntArray) : IntArray { | |
| val newArray = IntArray(array1.size + array2.size ) | |
| for ((index, value) in array1.withIndex()) { | |
| newArray[index] = value | |
| } | |
| for ((index, value) in array2.withIndex()) { | |
| newArray[index + array1.size] = value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Copy using the lamda in the constructor | |
| fun catTwoIntArrays3(array1 :IntArray, array2 :IntArray) : IntArray { | |
| return IntArray(array1.size + array2.size, | |
| { if (it<array1.size) array1[it] else array2[it-array1.size]}) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Copy using the lamda in the constructor | |
| inline fun <reified T> catTwoArrays3(array1 :Array<T>, array2 :Array<T>) : Array<T> { | |
| return Array<T>(array1.size + array2.size, | |
| { if (it<array1.size) array1[it] else array2[it-array1.size]}) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Create a class that mimics an immutable Array<> | |
| class CatTwoArrays<T>(internal val array1 : Array<T>, internal val array2 : Array<T>) { | |
| public operator fun get(index: Int): T { | |
| return if (index < array1.size) array1[index] else array2[index - array1.size] | |
| } | |
| public val size: Int = array1.size + array2.size | |
| internal inner class CatTwoArraysIterator() : Iterator<T> { | |
| internal var position = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Silly simple way of making new array | |
| fun catTwoIntArraysSimple(array1 :IntArray, array2 :IntArray) = array1 + array2 | |
| inline fun <reified T> catTwoArraysSimple(array1 :Array<T>, array2 :Array<T>) = array1 + array2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Test { | |
| private fun returnSomething(str: String):String { | |
| println("evaluating $str") | |
| return str | |
| } | |
| val testEquals = returnSomething("testEquals") | |
| val testLazy by lazy { returnSomething("testLazy") } | |
| val testGetBrackets: String | |
| get() { return returnSomething("testGetBrackets") } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun performCheck(context: Context, callback: Callback, defaultEntryPoint: Boolean = false) { | |
| compositeDisposable.add(job(1).subscribeOn(Schedulers.io()) | |
| .mergeWith(job(2).subscribeOn(Schedulers.io())) | |
| .mergeWith(job(3).subscribeOn(Schedulers.io())) | |
| .observeOn(AndroidSchedulers.mainThread()) | |
| .subscribe( | |
| { callback.pass() | |
| Timber.d("Job OnComplete") | |
| }, | |
| { callback.fail(Callback.FailReason.LoggedOut) |
OlderNewer