foreach not applicable to expression type

前端 未结 3 1418
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-11 18:39

what does this error mean? and how do i solve it?

foreach not applicable to expression type.

im am trying to write a method find(). that find a string in a l

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-11 19:28

    Without code this is just a grasp at straws.

    If you're trying to write your own list-find method, it would be like this

     boolean contains(E e, List list) {
    
        for(E v : list) if(v.equals(e)) return true;
        return false;
    }
    

提交回复
热议问题