Звучит довольно интересно, почему IntelliJ не показывает возвращаемых значений в консоли из этой функции снятых. System.out.println, однако, входит в систему правильно. < /P>
public class ContainsDuplicate {
public static boolean removeDups(int [] nums){
HashSet numberSet = new HashSet();
for( int num : nums){
if (numberSet.contains(num)){
//sout here works
return true;
}
numberSet.add(num);
}
//sout here works
return false;
}
public static void main(String[] args) {
int [] newArrys = new int[]{1,2,3,4,4};
removeDups(newArrys);
}
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... a-function