Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.util.SparseBooleanArray;

public class Main {
    public static SparseBooleanArray cloneSBArray(SparseBooleanArray arr) {
        try {
            return arr.clone();
        } catch (Exception e) {
            // Happens when using HC - should clone manually
            int size = arr.size();
            SparseBooleanArray clone = new SparseBooleanArray();
            for (int i = 0; i < size; i++) {
                if (arr.get(arr.keyAt(i))) {
                    clone.put(arr.keyAt(i), true);
                }
            }
            return clone;
        }
    }
}