All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bmd.android.collection.internal.CompatIterableFactory Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bmd.android.collection.internal;

import android.support.v4.util.LongSparseArray;
import android.support.v4.util.SimpleArrayMap;
import android.support.v4.util.SparseArrayCompat;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;

import com.bmd.android.collection.iterator.SimpleArrayMapIterable;
import com.bmd.android.collection.iterator.SparseArrayCompatIterable;
import com.bmd.android.collection.iterator.SparseArrayIterable;
import com.bmd.android.collection.iterator.SparseBooleanArrayIterable;
import com.bmd.android.collection.iterator.SparseIntArrayIterable;
import com.bmd.android.collection.iterator.SupportLongSparseArrayIterable;

/**
 * Utility class implementing a factory of
 * {@link com.bmd.android.collection.iterator.SparseIterable} instances wrapping specific sparse
 * collections.
 * 

* This class represents the entry point to the internal package. *

* Created by davide on 3/10/14. */ public class CompatIterableFactory { /** * Avoid direct instantiation. */ CompatIterableFactory() { } /** * Wraps the specified {@link android.support.v4.util.SimpleArrayMap} into an iterable. * * @param arrayMap The array map to wrap. * @param The element key type. * @param The element value type. * @return The iterable instance. */ public static SimpleArrayMapIterable create(final SimpleArrayMap arrayMap) { return new SimpleArrayMapIterableImpl(arrayMap); } /** * Wraps the specified {@link android.support.v4.util.LongSparseArray} into an iterable. * * @param sparseArray The sparse array to wrap. * @param The element value type. * @return The iterable instance. */ public static SupportLongSparseArrayIterable create( final LongSparseArray sparseArray) { return new SupportLongSparseArrayIterableImpl(sparseArray); } /** * Wraps the specified {@link android.util.SparseArray} into an iterable. * * @param sparseArray The sparse array to wrap. * @param The element value type. * @return The iterable instance. */ public static SparseArrayIterable create(final SparseArray sparseArray) { return new SparseArrayIterableImpl(sparseArray); } /** * Wraps the specified {@link android.support.v4.util.SparseArrayCompat} into an iterable. * * @param sparseArray The sparse array to wrap. * @param The element value type. * @return The iterable instance. */ public static SparseArrayCompatIterable create(final SparseArrayCompat sparseArray) { return new SparseArrayCompatIterableImpl(sparseArray); } /** * Wraps the specified {@link android.util.SparseBooleanArray} into an iterable. * * @param sparseArray The sparse array to wrap. * @return The iterable instance. */ public static SparseBooleanArrayIterable create(final SparseBooleanArray sparseArray) { return new SparseBooleanArrayIterableImpl(sparseArray); } /** * Wraps the specified {@link android.util.SparseIntArray} into an iterable. * * @param sparseArray The sparse array to wrap. * @return The iterable instance. */ public static SparseIntArrayIterable create(final SparseIntArray sparseArray) { return new SparseIntArrayIterableImpl(sparseArray); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy