Back to project page ShareList-Android.
The source code is released under:
GNU General Public License
If you think the Android project ShareList-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.mybop.sharelist.app.util; //ww w. j ava2 s . c om import java.util.AbstractList; import java.util.List; /** * Created by gautier on 22/03/2014. */ public final class ArrayUtil { private ArrayUtil() { } public static <T> boolean contains(final T[] array, final T v) { for (final T e : array) if (e == v || v != null && v.equals(e)) return true; return false; } public static boolean contains(final double[] array, final double v) { for (final double e : array) if (e == v) return true; return false; } public static boolean contains(final float[] array, final float v) { for (final float e : array) if (e == v) return true; return false; } public static boolean contains(final long[] array, final long v) { for (final long e : array) if (e == v) return true; return false; } public static boolean contains(final int[] array, final int v) { for (final int e : array) if (e == v) return true; return false; } public static boolean contains(final byte[] array, final byte v) { for (final byte e : array) if (e == v) return true; return false; } public static List<Long> asList(final long[] l) { return new AbstractList<Long>() { public Long get(int i) { return l[i]; } // throws NPE if val == null public Long set(int i, Long val) { Long oldVal = l[i]; l[i] = val; return oldVal; } public int size() { return l.length; } }; } }