Skip to content

Commit

Permalink
added SimpleArrayMap<K, V>.toKeyList()
Browse files Browse the repository at this point in the history
  • Loading branch information
hereisderek committed Sep 3, 2019
1 parent a104929 commit 2d66b00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: android
# os: linux
# sudo: required
# jdk: oraclejdk8
# dist: trusty
jdk: oraclejdk8
sudo: false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.hereisderek.androidutil.collection

import androidx.collection.SimpleArrayMap
import java.lang.IndexOutOfBoundsException

/**
Expand Down Expand Up @@ -40,4 +41,15 @@ fun FloatArray.set(vararg values: Float) {
values.forEachIndexed { index, fl ->
this[index] = fl
}
}


fun <K, V> SimpleArrayMap<K, V>.toKeyList() : List<K> {
val size = this.size()
if (size() == 0) return emptyList()
val list = ArrayList<K>(size())
for ( i in 0 until size) {
list.add(this.keyAt(i))
}
return list
}

0 comments on commit 2d66b00

Please sign in to comment.