1/*
2 * Copyright (C) 2007 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 com.android.dx.cf.iface;
18
19import com.android.dx.util.FixedSizeList;
20
21/**
22 * Standard implementation of {@link MethodList}, which directly stores
23 * an array of {@link Method} objects and can be made immutable.
24 */
25public final class StdMethodList extends FixedSizeList implements MethodList {
26    /**
27     * Constructs an instance. All indices initially contain {@code null}.
28     *
29     * @param size the size of the list
30     */
31    public StdMethodList(int size) {
32        super(size);
33    }
34
35    /** {@inheritDoc} */
36    public Method get(int n) {
37        return (Method) get0(n);
38    }
39
40    /**
41     * Sets the method at the given index.
42     *
43     * @param n {@code >= 0, < size();} which method
44     * @param method {@code null-ok;} the method object
45     */
46    public void set(int n, Method method) {
47        set0(n, method);
48    }
49}
50