문제

I need to make sure that a certain long value isn't in an array. But for some reason, this isn't working...

!d.toString().contains(sq.toString());

I am sure I am getting something really backwards... but I can't figure out what!

도움이 되었습니까?

해결책

Try

!Arrays.asList(d).contains(sq);

다른 팁

Look at the static methods in java.util.Arrays. Your array will need to be sorted for the binarySearch() to work.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top