APISonar


java.util.ArrayList.get

> java > util > ArrayList > get
java APIs util APIs ArrayList APIs get APIs

Example 1
private final ArrayList<T> _list;

  public T get( int i )
  {
    return _list.get( i );
  }
Example 2
protected static int max(ArrayList<Integer> a) {
        assert a.size() > 0;
        if (a.size() == 1) return a.get(0);
        if (a.size() == 2) return Math.max(a.get(0), a.get(1));
        int r = a.get(0);
        for (int i = 1; i < a.size(); i++) if (a.get(i) > r) r = a.get(i);
        return r;
    }
Example 3
public static double median(ArrayList<Double> m) {

        Collections.sort(m);

        int middle = m.size()/2;

        if (m.size()%2 == 1)
            return m.get(middle);

        else
            return (m.get(middle-1) + m.get(middle)) / 2.0;

    }
Example 4
protected ArrayList list = null;

    public Object get(int index) {

        if (fast) {
            return (list.get(index));
        } else {
            synchronized (list) {
                return (list.get(index));
            }
        }

    }
Example 5
private ArrayList<StringBuffer> rows;

	public char get(int x, int y){
		if(x > getWidth() - 1
			|| y > getHeight() - 1
			|| x < 0
			|| y < 0) return 0;
		return rows.get(y).charAt(x);
	}
Example 6
private ArrayList<Process> remainingProcess;

    public void ageing(int k) {
        for (int i = k; i < remainingProcess.size(); i++) {
            remainingProcess.get(i).waitTime++;
            if (remainingProcess.get(i).waitTime % 7 == 0) {
                remainingProcess.get(i).priority--;
            }
        }
    }
Example 7
ArrayList<ArrayList<Integer>> cycles = new ArrayList<ArrayList<Integer>>();

    public void printAll() {
        for (int i = 0; i < cycles.size(); i++) {
            for (int j = 0; j < cycles.get(i).size(); j++) {
                System.out.print(cycles.get(i).get(j) + " -> ");
            }
            System.out.println(cycles.get(i).get(0));
            System.out.println();
        }

    }
Example 8
ArrayList   registrants = new ArrayList();      // of Registrant

    public synchronized Object
    get(int index)
    {
        return registrants.get(index);
    }
Example 9
static ArrayList<ArrayList<ArrayList<String>>> item3 = new ArrayList<>();

    private void updateAdress(int[] pos) {
        String temp = item1.get(pos[0]) + item2.get(pos[0]).get(pos[1]) + item3.get(pos[0]).get(pos[1]).get(pos[2]);
        address.setText(temp);
    }
Example 10
private ArrayList<String> header;

    public Object getColumnValue(int column) {
        String columnName = header.get(column);
        try {
            if (currentPos < size) {
                return ((List<?>) data.get(columnName)).get(currentPos);
            } else {
                return null;
            }
        } catch (Exception e) {
            return null;
        }
    }
Example 11
private ArrayList<PointF> piecePositions;

    protected void onDraw(Canvas canvas) {
        canvas.drawLine(
                piecePositions.get(1).x,
                piecePositions.get(1).y,
                (piecePositions.get(0).x - piecePositions.get(1).x) * processForLine1 + piecePositions.get(1).x,
                (piecePositions.get(0).y - piecePositions.get(1).y) * processForLine1 + piecePositions.get(1).y, linePaint);
        linePaint.setColor(line2Color);
        canvas.drawLine(
                piecePositions.get(2).x,
                piecePositions.get(2).y,
                (piecePositions.get(1).x - piecePositions.get(2).x) * processForLine2 + piecePositions.get(2).x,
                (piecePositions.get(1).y - piecePositions.get(2).y) * processForLine2 + piecePositions.get(2).y, linePaint);
        super.onDraw(canvas);
    }
Example 12
protected final ArrayList<String> stringArray;

    protected void setStationType() {
        if (!stringArray.isEmpty()) {
            if (stringArray.get(0).length() == 4) {
                stationType = stringArray.get(0);
            } else {
                stationType = "";
            }
        }
    }
Example 13
private ArrayList<ArrayList<Object>> usage = new ArrayList<>();

  public double relativeFill() {
    final int cols = widths.size(), rows = heights.size();
    double acc = 0.0;
    for(int y = 0; y < rows; y++) {
      for(int x = 0; x < cols; x++) {
        if(usage.get(y).get(x) != null) {
          acc += widths.get(x) * heights.get(y);
        }
      }
    }
    return acc / (twidth * theight);
  }
Example 14
private ArrayList<ObjectPool.Entry<Rect>> list;

	public Rect get(int i)
	{
		return list.get(i).get();
	}
Example 15
public void process( String subject, ArrayList<String> values ) {
    if ( ADD_GROUPS_SUBJECT.equals( subject ) ) {
      doAddGroups( values.get( 0 ) );
    } else if ( REMOVE_GROUPS_SUBJECT.equals( subject ) ) {
      doRemoveGroups( values.get( 0 ) );
    } else if ( ADD_POLICY_SUBJECT.equals( subject ) ) {
      doAddPolicy( values.get( 0 ), values.get( 1 ) );
    } else if ( ADD_CERT_SUBJECT.equals( subject ) ) {
      doAddCert( values.get( 0 ) );
    } else if ( CHANGE_PASSWORD_SUBJECT.equals( subject ) ) {
      doChangePassword( values.get( 0 ), values.get( 1 ) );
    }
  }
Example 16
public int setPriorityToMember(String poolId ,String memberId){
		if(pools.containsKey(poolId)) {
			ArrayList<String> memberIds = pools.get(poolId).members;
			if(memberIds !=null && members != null && memberIds.contains(memberId)){
				for (int i = 0; i<memberIds.size(); i++){
					if(members.get(memberIds.get(i)).id.equals(memberId)){
						members.get(memberId).weight=(short) (1 + memberIds.size()/2);
					}else
						members.get(memberIds.get(i)).weight=1;
				}
				return 0;
			}
		}
		return -1;
	}
Example 17
private ArrayList<String> mPathList;

    public void onCheckedChanged() {
        String path = mPathList.get(mCurrentPosition);
        mCheckedMap.put(path, !mCheckedMap.get(path));

        setCheckedCount();
    }
Example 18
private final ArrayList<T> list = new ArrayList<T>();

    @Override public T get(int index) {
        rwl.readLock().lock();
        try {
            return list.get(index);
        } finally {
            rwl.readLock().unlock();
        }
    }
Example 19
private final ArrayList<T> oldItems;

  public boolean areItemsTheSame(int oldItemPosition,
                                 int newItemPosition) {
    return(oldItems.get(oldItemPosition)
      .equals(newItems.get(newItemPosition)));
  }
Example 20
private ArrayList definitionElement;

    public String getDefiningElement(int i)
    {
    	return (String)definitionElement.get(i);
    }
Example 21
public ArrayList<RowSet> inputRowSets;

    private RowSet currentInputStream()
    {
        return inputRowSets.get(currentInputRowSetNr);
    }
Example 22
private ArrayList list;

	public Condition getCondition(int i)
	{
		return (Condition)list.get(i);
	}
Example 23
public static int nInputs(String fin_inputs) {
        ArrayList<ArrayList<String>> inputs_list = Util.fileTokenizer(fin_inputs);
        ArrayList<String> input_names = new ArrayList<String>();

        for(int i=inputs_list.size()-1; i>=0; --i) {

            if(inputs_list.get(i).get(0).substring(0,1).equals("#")) { //commented out
                continue;
            }
            input_names.add(inputs_list.get(i).get(0));
        }
        return input_names.size();
    }
Example 24
ArrayList<String> list;

    public String get(int i)
    {
        if (i < 0 || i >= list.size())
            throw new IndexOutOfBoundsException("Int value out of range: "+i);
        return list.get(i);
    }
Example 25
void testArrayListGet() {

        ArrayList<Integer> list = new ArrayList<Integer>();
        int i = -1;
        int j = 0;

        //try and use a negative to get, should fail
        //:: error: (argument.type.incompatible)
        Integer m = list.get(i);

        //try and use a nonnegative, should work
        Integer l = list.get(j);
    }