put two SparseArray together - Android android.util

Android examples for android.util:SparseArray

Description

put two SparseArray together

Demo Code


//package com.java2s;

import android.util.SparseArray;

public class Main {
    public static <E> SparseArray<E> putAll(SparseArray<E> source,
            SparseArray<E> dest) {
        if (dest == null)
            dest = source;//from  w  w w. j  av a  2  s.  c om
        else if (source != null)
            for (int i = 0; i < source.size(); i++) {
                int key = source.keyAt(i);
                E value = source.valueAt(i);
                dest.put(key, value);
            }
        return dest;
    }
}

Related Tutorials