1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 package org.apache.giraph.types.ops.collections.array; 19 import org.apache.giraph.types.ops.collections.WCollection; 20 21 /** 22 * Array list over mutable elements, which are probably 23 * internally stored differently/efficiently, and are accessed 24 * through methods providing "return" value. 25 * 26 * @param <T> Element type 27 */ 28 public interface WArrayList<T> extends WCollection<T> { 29 /** 30 * Sets the size of this 31 * 32 * <P> 33 * If the specified size is smaller than the current size, 34 * the last elements are discarded. 35 * Otherwise, they are filled with 0/<code>null</code>/<code>false</code>. 36 * 37 * @param newSize the new size. 38 */ 39 void size(int newSize); 40 /** 41 * Trims this array list so that the capacity is equal to the size. 42 * 43 * @see java.util.ArrayList#trimToSize() 44 */ 45 void trim(); 46 /** 47 * Pop value from the end of the array, storing it into 'to' argument 48 * @param to Object to store value into 49 */ 50 void popIntoW(T to); 51 /** 52 * Get element at given index in the array, storing it into 'to' argument 53 * @param index Index 54 * @param to Object to store value into 55 */ 56 void getIntoW(int index, T to); 57 /** 58 * Set element at given index in the array 59 * @param index Index 60 * @param value Value 61 */ 62 void setW(int index, T value); 63 /** 64 * Sets given range of elements to a specified value. 65 * 66 * @param from From index (inclusive) 67 * @param to To index (exclusive) 68 * @param value Value 69 */ 70 void fillW(int from, int to, T value); 71 /** Sort the array in ascending order */ 72 void sort(); 73 }