Created
May 21, 2014 09:12
-
-
Save vegaasen/e0d52eee15a8583cdd42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.telenor.security.sso.api.service.utils; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
/** | |
* @author <a href="mailto:vegard.aasen@telenor.com">Vegard Aasen</a> | |
* @since 21:38 | |
*/ | |
public class CollectionUtils { | |
private CollectionUtils() { | |
} | |
public static <E> List<E> toList(Iterable<E> iter) { | |
if (iter == null || iter.iterator() == null || !iter.iterator().hasNext()) { | |
return Collections.emptyList(); | |
} | |
final List<E> list = new ArrayList<>(); | |
for (final E item : iter) { | |
list.add(item); | |
} | |
return list; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment