1/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.util;
18
19public class SparseIntArray {
20    private final SparseArray<Integer> mArray;
21
22    public SparseIntArray() {
23        this(10);
24    }
25
26    public SparseIntArray(final int initialCapacity) {
27        mArray = new SparseArray<>(initialCapacity);
28    }
29
30    public int size() {
31        return mArray.size();
32    }
33
34    public void clear() {
35        mArray.clear();
36    }
37
38    public void put(final int key, final int value) {
39        mArray.put(key, value);
40    }
41
42    public int get(final int key) {
43        return get(key, 0);
44    }
45
46    public int get(final int key, final int valueIfKeyNotFound) {
47        return mArray.get(key, valueIfKeyNotFound);
48    }
49
50    public int indexOfKey(final int key) {
51        return mArray.indexOfKey(key);
52    }
53
54    public int keyAt(final int index) {
55        return mArray.keyAt(index);
56    }
57}
58