Java 如何迭代数组哈希表中没有参数的方法?[爪哇]
因此,我可以通过将索引设置为离开I的c[h]来遍历具有参数的列表,但我不确定在没有参数的情况下如何操作。如果没有这个索引,我将如何进行迭代?用于省略和打印Java 如何迭代数组哈希表中没有参数的方法?[爪哇],java,arrays,iteration,hashtable,Java,Arrays,Iteration,Hashtable,因此,我可以通过将索引设置为离开I的c[h]来遍历具有参数的列表,但我不确定在没有参数的情况下如何操作。如果没有这个索引,我将如何进行迭代?用于省略和打印 { private int howmany; private int[] c; int counter = 0; public Intcoll7() { c = new int[23]; howmany = 0; } public Intcoll7(int i) { double z = (i %
{
private int howmany;
private int[] c;
int counter = 0;
public Intcoll7()
{
c = new int[23];
howmany = 0;
}
public Intcoll7(int i)
{
double z = (i % 23);
int y = (int) z;
while (!isprime(y))
{
y--;
}
howmany = 0;
}
public void insert(int i)
{
int h = i % 23;
int H = h;
if (c[h] == 0)
{
c[h] = i;
howmany++;
} else if (c[h] == i) ; else
{
if (h < c.length - 1)
{
h++;
} else
{
h = 0; // why does h = 0?
}
while ((h != H) && (c[h] != 0) && (c[h] != i))
{
if (h < c.length - 1)
{
h++;
} else
{
h = 0;
}
}
if (h != H)
{
if (c[h] == 0)
{
c[h] = i;
howmany++;
}
} else
{
System.out.println("Table Full");
System.exit(1);
}
}
}
public boolean belongs(int i)
{
//address
int h = i % 23;
int H = h; // what
if (c[h] == 0)
{
return false;
} if (c[h] == H)
{
return true;
}
else
{
return false;
}
}
public void omit(int i)
{
int h = i % 23;
if (c[h] == i)
{
if (counter == 3)
{
//crate new array
}
c[h] = i * (-1);
counter++;
}
}
private static boolean isprime(int n)
{
int i = 2;
boolean result = true;
while ((i <= n / 2) && result)
{
if (n % i == 0)
{
result = false;
} else
{
i++;
}
}
return (result);
}
public void print()
{
System.out.println();
//int x = c[z];
//System.out.println(x);
}
}
{
私人int有多少;
私有int[]c;
int计数器=0;
公共Intcoll7()
{
c=新整数[23];
多少=0;
}
公共Intcoll7(int i)
{
双z=(i%23);
int y=(int)z;
而(!isprime(y))
{
y--;
}
多少=0;
}
公共空白插入(int i)
{
inth=i%23;
int H=H;
如果(c[h]==0)
{
c[h]=i;
有多少个++;
}else如果(c[h]==i;else
{
如果(h while((我想知道,你用了[a-z]
中的所有字母了吗?还是还有一些?看看你能不能在什么地方调整一下。你不喜欢xyz
?