Created
July 25, 2015 14:32
-
-
Save TheFinestArtist/44e50101c4f6f31c5188 to your computer and use it in GitHub Desktop.
SparseArrayHelper.java
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
import android.util.SparseArray; | |
import java.util.ArrayList; | |
/** | |
* SparseArrayHelper | |
* | |
* Created by TheFinestArtist | |
*/ | |
public class SparseArrayHelper { | |
public static <C> ArrayList<C> asArrayList(SparseArray<C> sparseArray) { | |
if (sparseArray == null) return new ArrayList<C>(); | |
ArrayList<C> arrayList = new ArrayList<C>(sparseArray.size()); | |
for (int i = 0; i < sparseArray.size(); i++) | |
arrayList.add(sparseArray.valueAt(i)); | |
return arrayList; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment