util-common/src/main/java/io/activej/common/Utils.java
/**
	 * Concatenates two lists into one
	 * <p>
	 * No guarantee on a mutability of a resulting list is made,
	 * so list should be considered unmodifiable
	 * <p>
	 * If any of concatenated lists is modified, the behaviour of a concatenated list is undefined
	 */
Concatenates two lists into one

No guarantee on a mutability of a resulting list is made,
so list should be considered unmodifiable

If any of concatenated lists is modified, the behaviour of a concatenated list is undefined
Concatenates two lists into one No guarantee on a mutability of a resulting list is made so list should be considered unmodifiable If any of concatenated lists is modified the behaviour of a concatenated list is undefined
@SuppressWarnings("unchecked")
	public static <D> List<D> concat(List<? extends D> list1, List<? extends D> list2) {
		if (list1.isEmpty()) return (List<D>) list2;
		if (list2.isEmpty()) return (List<D>) list1;
		Object[] objects = new Object[list1.size() + list2.size()];
		System.arraycopy(list1.toArray(), 0, objects, 0, list1.size());
		System.arraycopy(list2.toArray(), 0, objects, list1.size(), list2.size());
		return (List<D>) List.of(objects);
	}
@ SuppressWarnings ( "unchecked" ) public static < D > List < D > concat ( List < ? extends D > list1 , List < ? extends D > list2 ) { if ( list1 . isEmpty ( ) ) return ( List < D > ) list2 ; if ( list2 . isEmpty ( ) ) return ( List < D > ) list1 ; Object [ ] objects = new Object [ list1 . size ( ) + list2 . size ( ) ] ; System . arraycopy ( list1 . toArray ( ) , 0 , objects , 0 , list1 . size ( ) ) ; System . arraycopy ( list2 . toArray ( ) , 0 , objects , list1 . size ( ) , list2 . size ( ) ) ; return ( List < D > ) List . of ( objects ) ; }
Concatenates two lists into one
 <p>
 No guarantee on a mutability of a resulting list is made,
 so list should be considered unmodifiable
 <p>
 If any of concatenated lists is modified, the behaviour of a concatenated list is undefined
Concatenates two lists into one <p > No guarantee on a mutability of a resulting list is made so list should be considered unmodifiable <p > If any of concatenated lists is modified the behaviour of a concatenated list is undefined