Here you can find the source of removeElement(Object[] array, Object entryToRemove)
Parameter | Description |
---|---|
array | a parameter |
value | a parameter |
public static Object[] removeElement(Object[] array, Object entryToRemove)
//package com.java2s; /*//from w w w. j a v a 2s . c om Pulsar Copyright (C) 2013-2015 eBay Software Foundation Licensed under the GPL v2 license. See LICENSE for full terms. */ import java.util.ArrayList; import java.util.List; public class Main { /** * Removes element from an array. It's faster that turning array into stream and then using WHERE clause. * * @param array * @param value * @return */ public static Object[] removeElement(Object[] array, Object entryToRemove) { if (array != null && entryToRemove != null) { List<Object> list = new ArrayList<Object>(); for (Object entry : array) { if (entry == null || !entry.equals(entryToRemove)) { list.add(entry); } } return list.toArray(); } return array; } }