Skip to content

Commit 4ce6d91

Browse files
committed
P417: Renamed a class and method in Java solution for clarity.
1 parent 1f0516d commit 4ce6d91

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

java/p417.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ private static int[] calcSmallestPrimeFactors(int[] primes) {
9898

9999

100100
private static long[] calcPrimePowersAndTotients(int[] primes) {
101-
DynamicArray temp = new DynamicArray(primes.length * 2);
101+
LongList temp = new LongList(primes.length * 2);
102102
for (int p : primes) {
103103
if (p == 2 || p == 5)
104104
continue;
105105
for (long pow = p, tot = p - 1; pow <= LIMIT; pow *= p, tot *= p)
106-
temp.add(pow << 32 | tot);
106+
temp.append(pow << 32 | tot);
107107
}
108108
long[] result = temp.toArray();
109109
Arrays.sort(result);
@@ -170,21 +170,21 @@ private static int lcm(int x, int y) {
170170

171171

172172
// A growable list of long values that is more time- and space-efficient than java.util.List<Long>
173-
private static class DynamicArray {
173+
private static class LongList {
174174

175175
private long[] data;
176176
private int length;
177177

178178

179-
public DynamicArray(int initCapacity) {
179+
public LongList(int initCapacity) {
180180
if (initCapacity < 1)
181181
throw new IllegalArgumentException();
182182
data = new long[initCapacity];
183183
length = 0;
184184
}
185185

186186

187-
public void add(long x) {
187+
public void append(long x) {
188188
if (length == data.length)
189189
data = Arrays.copyOf(data, length * 2);
190190
data[length] = x;

0 commit comments

Comments
 (0)