Make Exported just be SquirrelJMEVendorApi.
[SquirrelJME.git] / modules / cldc-compact / src / main / java / cc / squirreljme / runtime / cldc / util / CollectionUtils.java
blob2518fb41d8e2debb4e0ad320588ced094c7e8838
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc.squirreljme.runtime.cldc.util;
12 import java.util.List;
13 import java.util.RandomAccess;
15 /**
16 * General utilities for collections.
18 * @since 2021/02/25
20 public final class CollectionUtils
22 /**
23 * Not used.
25 * @since 2021/02/25
27 private CollectionUtils()
31 /**
32 * Wraps the given character list as an integer list.
34 * @param __chars The character list to wrap.
35 * @return The resultant integer list.
36 * @throws NullPointerException On null arguments.
37 * @since 2021/02/25
39 public static List<Integer> asIntegerList(List<Character> __chars)
40 throws NullPointerException
42 if (__chars == null)
43 throw new NullPointerException("NARG");
45 if (__chars instanceof RandomAccess)
46 return new __CharacterIntegerListRandom__(__chars);
47 return new __CharacterIntegerListSequential__(__chars);