package pollseed.util.list;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
 * List class Extension (for updating java7 to java8).
 * 
 * @version java8
 */
public class ListEx {

    /**
     * To count the list removed by {@code excludes} list
     * 
     * @param list
     *            {@code List<T>} target list
     * @param excludes
     *            {@code List<T>} Removing excludes list
     * @param isNotNull
     *            {@code true} if NOT NULL (target list)
     * @return size of target list
     * @since v0.1
     */
    public static <T> int countList(
            final List<T> list,
            final List<T> excludes,
            final boolean isNotNull) {
        return Optional.ofNullable(
                Optional.ofNullable(list).isPresent() ? new ArrayList<>(list) : new ArrayList<>()).map(
                e -> {
                    Optional.ofNullable(excludes).ifPresent(
                            optionalExcludes -> optionalExcludes.forEach(exclude -> e.removeAll(Collections.singleton(exclude))));
                    if (isNotNull)
                        e.removeAll(Collections.singleton(null));
                    return e;
                }).get().size();
    }
}

@@ -300,25 +300,26 @@
 cludes%7D list
+.
 %0A
-
      * %0A    
@@ -517,16 +517,23 @@
 rue%7D if 
+%7B@code 
 NOT NULL
@@ -546,16 +546,18 @@
 et list)
+ %7D
 %0A     * 
@@ -794,106 +794,27 @@
 ble(
-%0A                Optional.ofNullable(list).isPresent() ? new Array
+toNotNull
 List
-%3C%3E
 (list)
- : new ArrayList%3C%3E()
 ).ma
@@ -1055,12 +1055,412 @@
     
-if (
+return toNotNullElementsList(e, isNotNull);%0A                %7D).get().size();%0A    %7D%0A%0A    /**%0A     * To count the list.%0A     * %0A     * @param list%0A     *            %7B@code List%3CT%3E%7D target list%0A     * @param isNotNull%0A     *            %7B@code true%7D if NOT NULL (target list)%0A     * @return size of target list%0A     * @since v0.1%0A     */%0A    public static %3CT%3E int countList(final List%3CT%3E list, final boolean 
 isNo
@@ -1465,16 +1465,18 @@
 NotNull)
+ %7B
 %0A       
@@ -1480,125 +1480,1042 @@
     
-                e.removeAll(Collections.singleton(null));%0A                    return e;
+return Optional.ofNullable(toNotNullList(list)).map(%0A                e -%3E toNotNullElementsList(e, isNotNull)).get().size();%0A    %7D%0A%0A    private static %3CT%3E List%3CT%3E toNotNullElementsList(final List%3CT%3E list, final boolean isNotNull) %7B%0A        if (isNotNull) %7B%0A            return toNotNullElementsList(list);%0A        %7D%0A        return list;%0A    %7D%0A%0A    /**%0A     * To get the list remove %7B@code NULL%7D elements.%0A     * %0A     * @param list%0A     *            %7B@code List%3CT%3E%7D target list%0A     * @return%0A     */%0A    public static %3CT%3E List%3CT%3E toNotNullElementsList(final List%3CT%3E list) %7B%0A        final List%3CT%3E tmp = toNotNullList(list);%0A        tmp.removeAll(Collections.singleton(null));%0A        return tmp;%0A    %7D%0A%0A    /**%0A     * To get the %7B@code Not Null List%3CT%3E%7D%0A     * %0A     * @param list%0A     *            %7B@code List%3CT%3E%7D target list%0A     * @return %7B@code Not Null List%3CT%3E%7D
 %0A     
+*/%0A
     
-       %7D).get().size
+public static %3CT%3E List%3CT%3E toNotNullList(final List%3CT%3E list) %7B%0A        return Optional.ofNullable(list).isPresent() ? new ArrayList%3C%3E(list) : new ArrayList%3C%3E
 ();%0A

Update ListEx.java