View RSS Feed

All Blog Entries

  1. Making your own class Iterable.

    by , 02-09-2012 at 08:21 PM
    Java Code:
    package myPaackkage;
    
    import java.util.*;
    
    
    public class SomeClass implements Iterable<String> 
    {
    	@Override
    	public Iterator<String> iterator() 
    	{
    		System.out.println("Hello!!");
    		
    		return new Iterator<String>()
    				{
    			private int i = 0;
    
    					@Override
    					public boolean hasNext() {
    						while(i<words.size())
    							return true;
    ...

    Updated 02-21-2012 at 11:33 PM by fatabass (Code tags.)

    Categories
    Uncategorized
  2. Checking for Randomness of Java with HashMap

    by , 02-07-2012 at 11:19 PM
    Java Code:
    package myPaackkage;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.ListIterator;
    import java.util.Random;
    
    public class SayisalGenerator {
    	
    	static Random myRandomGenerator = new Random();
    	
    	public static void main(String[] args)
    	{
    		HashMap<Integer,Integer> myHashMap = new HashMap<Integer,Integer>();
    		
    		for(int i=0;i<1000;i++)
    		{
    ...
    Categories
    Uncategorized
  3. A little on Containers. ( Collections + Maps )

    by , 02-07-2012 at 08:39 PM
    Java Code:
    package myPaackkage;
    
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Collection;
    import java.util.Collections;
    import java.util.HashMap;
    import java.util.HashSet;
    import java.util.LinkedHashMap;
    import java.util.LinkedHashSet;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import java.util.TreeMap;
    import java.util.TreeSet;
    
    public class
    ...
    Categories
    Uncategorized
  4. Using of Inner Classes

    by , 02-06-2012 at 01:15 AM
    Java Code:
    package myPackage2;
    
    public abstract class Event 
    {
    	private long eventTime;
    	protected final long delayTime;
    	
    	public Event(long delayTime)
    	{
    		this.delayTime = delayTime;
    		start();
    	}
    	
    	public void start()
    	{
    		eventTime = System.nanoTime() + 2*delayTime;
    	}
    	
    	public boolean ready()
    	{
    		return System.nanoTime() >= eventTime;
    	}
    ...
    Categories
    Uncategorized
Page 25 of 48 FirstFirst ... 15232425262735 ... LastLast