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