Iterable « iterator « Java Collection Q&A

Home
Java Collection Q&A
1.algorithm
2.array
3.Array Byte
4.Array Char
5.Array Convert
6.Array Dimension
7.Array Integer
8.Array Object
9.Array String
10.ArrayList
11.collection
12.comparator
13.Development
14.Garbage Collection
15.Generic
16.hash
17.HashMap
18.HashTable
19.iterator
20.LinkedList
21.List
22.Map
23.queue
24.Set
25.Sort
26.tree
Java Collection Q&A » iterator » Iterable 

1. Why is Java's Iterator not an Iterable?    stackoverflow.com

Why does the Iterator interface not extend extend Iterable? The iterator() method could simply return 'this'. Is it on purpose or just an oversight of Java's designers? It would be convenient to be able ...

2. Java: why are iterators not copyable    stackoverflow.com

I would think that Iterator.copy() would be quite a handy function. You could implement iterator filters in a much better way. For example, the only reason in Googles Java Collection for the ...

3. Java Iterator and Iterable    stackoverflow.com

I am trying to understand Java Iterator and Iterable interfaces I am writing this class

class MyClass implements Iterable<String>{
    public String[] a=null;
    public MyClass(String[] arr){
  ...

4. What is the difference between iterator and iterable and how to use them?    stackoverflow.com

I am new in Java and I'm really confused with iterator and iterable. Can anyone explane to me and give some examples?

5. Why are Iterable and Iterator in different packages?    stackoverflow.com

Iterable<E> is in java.lang whereas Iterator<E> is in java.util. Is there a good reason for this or is this merely an artifact of bad design? It seems strange since the only thing ...

6. what is the differnce between Iterable & Iterator    java-forums.org

This is a classic example of an interface vs a concrete class. Usually object types ending in 'able' (Iterable, Comparable, etc...) are objects that implement some interface which guarantees a certain collection of methods will be available. An Iterator itself is a concrete object which is use for the iterations. As JosAH said, a class which implements Iterable is guaranteed to ...

7. Any reason Iterator does not extend Iterable?    forums.oracle.com

I haven't done so much with it that I could tell if such a hack makes sense or not, but I guess at some level it makes sense that the iterator itself does not know, how a list of objects should be iterated. Instead, the objects should tell the iterator what it needs to know.

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.