Java List Null Empty fillNull(final List list, final int numElements)

Here you can find the source of fillNull(final List list, final int numElements)

Description

fill Null

License

Open Source License

Declaration

public static <E> void fillNull(final List<E> list, final int numElements) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015, 2017 Lablicate GmbH.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from   www. java  2  s  .c o m*/
 * Dr. Alexander Kerner - initial API and implementation
 *******************************************************************************/

import java.util.List;

public class Main {
    public static <E> void fillNull(final List<E> list, final int numElements) {

        if (numElements < list.size())
            return;
        final int iterations = numElements - list.size();
        for (int i = 0; i < iterations; i++) {
            list.add(null);
        }
    }
}

Related

  1. emptyToNull(List list)
  2. emptyToNull(List list)
  3. equalsEmptyEqNull(List list1, List list2)
  4. equalsNullSafe(List list1, List list2)
  5. fillEmptyEntries(Iterable keys, Map> map)
  6. fillNull(List lst, int size)
  7. fillUpWithNulls(List list)
  8. getEmptyList(Class cls)
  9. getEmptyList(Class tClass)