package pl.pkk82.filehierarchygenerator.util;

import java.util.List;
import java.util.ListIterator;

public class ListUtil {

	public static <E> void insertBetween(List<E> list, E... elements) {
		if (list != null && list.size() > 1) {
			ListIterator<E> iIterator = list.listIterator();
			if (iIterator.hasNext()) {
				iIterator.next();
				if (iIterator.hasNext()) {
					for (E newElement : elements) {
						iIterator.add(newElement);
					}
				}
			}
		}
	}

	public static <E> void insertBefore(List<E> list, E... elements) {
		if (list != null) {
			ListIterator<E> iIterator = list.listIterator();
			for (E newElement : elements) {
				iIterator.add(newElement);
			}
		}
	}

	public static <E> void insertAfter(List<E> list, E... elements) {
		if (list != null) {
			ListIterator<E> iIterator = list.listIterator(list.size());
			for (E newElement : elements) {
				iIterator.add(newElement);
			}
		}
	}
}

@@ -120,16 +120,30 @@
 Util %7B%0A%0A
+%09@SafeVarargs%0A
 %09public 
@@ -467,32 +467,46 @@
 %09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%0A
+%09@SafeVarargs%0A
 %09public static %3C
@@ -710,16 +710,30 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09@SafeVarargs%0A
 %09public 

Add SafeVarargs annotations