Here you can find the source of orEmpty(T collection)
@SuppressWarnings("unchecked") public static <V, T extends Collection<V>> Collection<V> orEmpty(T collection)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Collections; public class Main { @SuppressWarnings("unchecked") public static <V, T extends Collection<V>> Collection<V> orEmpty(T collection) { return (collection == null ? (Collection<V>) Collections.emptyList() : collection); }/*from w w w . j ava 2 s .c o m*/ }