2013年11月12日 星期二

http://www.ubuntugeek.com/how-to-install-oracle-java-7-in-ubuntu-12-04.html

2013年10月28日 星期一

From .Net foreach KeyValuePair to Java Equivalent

public Set entrySet()
The entries in the returned Set are of type Map.Entry.
When working with the Set returned from entrySet(), you already have both the key and value together:
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class MainClass {
  public static void main(String[] s) {
    Hashtable table = new Hashtable();
    table.put("key1""value1");
    table.put("key2""value2");
    table.put("key3""value3");

    Set set = table.entrySet();
    Iterator it = set.iterator();
    while (it.hasNext()) {
      Map.Entry entry = (Map.Entryit.next();
      System.out.println(entry.getKey() " : " + entry.getValue());
    }
  }
}

Porting C# to Java

  1. Enum => EnumType
  2. Get/Set=>get_XXX/Set_XXX
  3. Dataset/Datarow=>Result?
  4. MessageQ=>RabbitMQ or ActiveMQ
  5. Event =>Listener
  6. bool=>boolean
  7. string=>String
  8. Tcplistener=>Serversocket
  9. str.Length=>str.length
  10. str.Substring=>str.substring
  11. Lock()=>synchronized
  12. DateTime.Now=>Calendar.getinstance().getTime()
  13. byte.ToString("X2")=>String.format("%02X", byte)
  14. Environment.CurrentDirectory=>
    new java.io.File( "." ).getCanonicalPath()/System.getProperty("user.dir") 
  15. new Queue()=>new LinkedList()

2013年10月23日 星期三