    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one
    003 * or more contributor license agreements.  See the NOTICE file
    004 * distributed with this work for additional information
    005 * regarding copyright ownership.  The ASF licenses this file
    006 * to you under the Apache License, Version 2.0 (the
    007 * "License"); you may not use this file except in compliance
    008 * with the License.  You may obtain a copy of the License at
    009 *
    010 *   https://www.apache.org/licenses/LICENSE-2.0
    011 *
    012 * Unless required by applicable law or agreed to in writing,
    013 * software distributed under the License is distributed on an
    014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    015 * KIND, either express or implied.  See the License for the
    016 * specific language governing permissions and limitations
    017 * under the License.
    018 */
    019package org.apache.bcel.util;
    020
    021import java.io.Serializable;
    022import java.util.ArrayList;
    023import java.util.List;
    024
    025import org.apache.bcel.classfile.JavaClass;
    026
    027/**
    028 * Utility class implementing a (typesafe) collection of JavaClass objects. Contains the most important methods of a
    029 * Vector.
    030 *
    031 * @deprecated as of 5.1.1 - 7/17/2005
    032 */
    033@Deprecated
    034public class ClassVector implements Serializable {
    035
    036    private static final long serialVersionUID = 5600397075672780806L;
    037
    038    @Deprecated
    039    protected transient List<JavaClass> vec = new ArrayList<>();
    040
    041    public void addElement(final JavaClass clazz) {
    042        vec.add(clazz);
    043    }
    044
    045    public JavaClass elementAt(final int index) {
    046        return vec.get(index);
    047    }
    048
    049    @SuppressWarnings("unused") // SE_TRANSIENT_FIELD_NOT_RESTORED
    050    private void readObjectNoData() {
    051        vec = new ArrayList<>();
    052    }
    053
    054    public void removeElementAt(final int index) {
    055        vec.remove(index);
    056    }
    057
    058    public JavaClass[] toArray() {
    059        return vec.toArray(JavaClass.EMPTY_ARRAY);
    060    }
    061}