,這裏是我的嘗試 public class blah {
HashSet<something> blah;
public Blah() {
this.blah = new HashSet<something>(); //this is empty constructor of something
}
//我想公共嗒嗒的所有元素複製在新布拉赫 public Blah(Bl
我想迭代一個HashSet的Integer對象,我想要計算一個元素出現的次數。這是我的方法到目前爲止 public int freq(int element) {
int numElements = 0;
for (int atPos : mySet){
if (mySet.atPos == element){ //says atPos cannot be res