私は次のコードを持っています
public class SBag<Item> implements BagInterface<Item>, Iterable<Item> {
そして、コンパイルしようとすると、
SBag.java:12: error: SBag is not abstract and does not override abstract method
iterator() in Iterable
public class SBag<Item> implements BagInterface<Item>, Iterable<Item>{
^
where Item is a type-variable:
Item extends Object declared in class SBag
私の仕事は、内部反復子クラスを使用せずに Iterable を実装することですが、コンパイル時にエラーが発生するため、これを行う方法がわかりません。次のメソッドがあります add()、isFull()、toArray()、isEmpty()、getCurrentSize()、remove()、clear()、および toString()。全体的な目標は、for-each ループを使用できるようにすることですが、ここから先に進む方法がわかりません。