Skip to content

markenwerk/android-commons-iterables

Repository files navigation

Some common iterators for Android

Build Status Maven Central API Level 8 MIT License

Overview

This is a collection of companion Iterables for some commonly useful Iterator implementations for the following use cases:

This library is an extensions of the corresponding library for Java, that contains Iterables for Android specific data structures.

This library is hosted in the Maven Central Repository. You can use it with the following coordinates:

compile 'net.markenwerk:android-commons-iterables:3.1.0'

Consult the usage description and Javadoc for further information.

Usage

Iterating over sparse arrays

This library provides the following Iterables that take existing sparse arrays and generate Iterables and yield all elements of the given array wrapped in an Entry:

SparseArray<Foo> sparseArray = ...

// generated iterables yield every foo from sparseArray
Iterable<Entry<Integer, Foo>> arraytIterable = new SparseArrayIterable<>(sparseArray);

Iterating over other objects

This library provides the generic PairIterable that takes and existing Pair and generates Iterators that yield both contained values.

Pair<Foo, Foo> pair = ...

// yields both foos from pair
Iterable<Foo> pairIterator = new PairIterable<>(pair);

About

Some common iterables for Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages