Java List Remove remove(final List list, final int index, final T defaultValue)

Here you can find the source of remove(final List list, final int index, final T defaultValue)

Description

remove

License

Open Source License

Declaration

@SuppressWarnings("unused")
    public static <T> T remove(final List<T> list, final int index, final T defaultValue) 

Method Source Code


//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.util.List;

public class Main {
    @SuppressWarnings("unused")
    public static <T> T remove(final List<T> list, final int index, final T defaultValue) {
        return index < list.size() ? list.remove(index) : defaultValue;
    }/*from  w w w. j  ava2s.  co  m*/
}

Related

  1. remove(Collection entityList1, Collection entityList2, Comparator comparator)
  2. remove(final List list, final T... objects)
  3. remove(List aList, Object anObj)
  4. remove(List models, int start, int count)
  5. remove(List list, List elements)