Tags » Iterator

Iterable interface - enable for-each

This tutorial explains how to implement java.lang.Iterable<T> on a class to enable for-each loop based iteration through the collection of objects stored in that class. 617 more words

Enumeration and Iterator

Both Enumeration and Iterator is used for traversing through the underlying Collection. Enumeration can traverse limited collection such as Vectors and HashTable. Whereas Iterator can be used to almost all the  421 more words

fail-fast Vs fail-safe

Java provides the iterator to iterate the objects in the Collection. The rule is that the Collection should not be altered when iterating, if modified you will get the  … 367 more words

Even Fibonacci numbers

Rust Language implementation for project euler problem 2 named “Even Fibonacci numbers”

Each new term in the Fibonacci sequence is generated by adding the previous two terms.

32 more words

Python arguments

Original post here:

Arguments are passed by assignment. The rationale behind this is twofold:

  1. the parameter passed in is actually a reference to an object (
  2. 782 more words

POJ 1002 487-3279

Problem: http://poj.org/problem?id=1002
Solution: Map.
Note: It’s actually a rather easy one, but I overlooked the possibility of “000-
0000”. Also, the difference between head and resulted… 226 more words


CF 755B PolandBall and Game

Problem: http://codeforces.com/problemset/problem/755/B
Solution: It’s actually quite easy. If the equal string appears even times, then
simply compare n and m. Otherwise, n += 1 and compare n & m. 174 more words