blob: 8cd74daaed7b3993db92529d1610b42c36e4dfb4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
package java.util;
public class Arrays
{
private Arrays()
{
}
public static void fill(byte[] ret, byte v)
{
for (int i = 0; i != ret.length; i++)
{
ret[i] = v;
}
}
public static boolean equals(byte[] a, byte[] a2)
{
if (a == a2)
{
return true;
}
if (a == null || a2 == null)
{
return false;
}
int length = a.length;
if (a2.length != length)
{
return false;
}
for (int i = 0; i < length; i++)
{
if (a[i] != a2[i])
{
return false;
}
}
return true;
}
public static List asList(Object[] a)
{
return new ArrayList(a);
}
private static class ArrayList
extends AbstractList
{
private Object[] a;
ArrayList(Object[] array)
{
a = array;
}
public int size()
{
return a.length;
}
public Object[] toArray()
{
Object[] tmp = new Object[a.length];
System.arraycopy(a, 0, tmp, 0, tmp.length);
return tmp;
}
public Object get(int index)
{
return a[index];
}
public Object set(int index, Object element)
{
Object oldValue = a[index];
a[index] = element;
return oldValue;
}
public int indexOf(Object o)
{
if (o == null)
{
for (int i = 0; i < a.length; i++)
{
if (a[i] == null)
{
return i;
}
}
}
else
{
for (int i = 0; i < a.length; i++)
{
if (o.equals(a[i]))
{
return i;
}
}
}
return -1;
}
public boolean contains(Object o)
{
return indexOf(o) != -1;
}
}
}
|