Example of Java enums: http://javahowto.blogspot.com/2008/04/java-enum-examples.html
- It is sort of like a class because you can override method inside the enum.
- @Override public String toString() {....}
Struct like objects in Java:
- http://stackoverflow.com/questions/36701/struct-like-objects-in-java
- http://www.javacamp.org/javavscsharp/struct.html
- Java doesn't have structs
- in C# structs are:
- sealed (final)
- lightweight
- a value type, not a reference type (Object)
- more efficient than classes
Java vs. C# page: http://www.javacamp.org/javavscsharp/
- Has lots of really nice and clear comparisons.
- I need to read the whole thing
Benefits of using Final classes in Java: http://www.java-tips.org/blog/java-se/benefits-of-using-final-class.html
- Control
- no one can inherit
- final methods run faster than normal methods
- Java compiler may be able to inline a final method
- this link is suppose to dispute that
Ternary or conditional operator in Java: http://www.janeg.ca/scjp/oper/ternary.html
- operand1 ? operand2 : operand3;
- operand1 must be a boolean value or experssion
Operator overloading in Java: http://stackoverflow.com/questions/77718/java-operator-overload
- program cannot overload operator like '+' or '-'
- JFront will take overload code and convert it to something Java can compile
The C# dictionary is similar to the Java Map interface:
- http://download.oracle.com/javase/1.4.2/docs/api/java/util/Dictionary.html
- http://stackoverflow.com/questions/687942/java-map-equivalent-in-c
- Show going from Java Map to C# dictionary
- description of Map interface
The ArrayList Generic Class in Java:
- http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html
- Implements in List interface along with others
- not synchronized
- has an example of how to synchronize an ArrayList object
The C# ICollection interface:
- http://msdn.microsoft.com/en-us/library/92t2ye13.aspx
- seems similar to function of the Java Collection interface
Another C#/Java comparison: http://www.25hoursaday.com/CsharpVsJava.html#collections
A Java tutorial on collection interfaces:
- http://download.oracle.com/javase/tutorial/collections/interfaces/
- http://download.oracle.com/javase/tutorial/collections/
- top of tutorial for collections
Today I was confused as to why code would compile in my simple command line program and not in Eclipse.
- Sometimes the error messages in Eclipse are miss leading
- I was trying to write code in the class body outside a method
Some examples of testing for null: http://www.daniweb.com/software-development/java/threads/156111
- if (child == null) child = new Lista(c, null);
A tutorial on Eclipse:
- http://www.vogella.de/articles/Eclipse/article.html
- perspectives
- a visual container for a set of view and editors
- java
- debug
- C++?
- view and editors are grouped into
- views
- editors
- projects
- located in workspace
- workspace
- physical location of projects
- I thing Eclipse is more complex for many things that NetBeans.
- It's really an SDK, rather than an IDE (NetBeans)
- Seeing the error can be a pain in the neck
- http://stackoverflow.com/questions/1671115/how-to-detect-eclipse-compile-errors-java-jdt
- http://stackoverflow.com/questions/585642/eclipse-3-4-1-how-to-view-compiler-output-in-console-while-building-a-project
- The Eclipse JDT provides its own build-in Java compiler
- tightly integrated with Eclipse and JDT (Java Development Tools)
- problems clearing 'Problems' window: http://stackoverflow.com/questions/2385402/eclipse-cdt-how-to-clear-problems-window-without-invoking-clean-project-or-build
- tried what was recommended, but it didn't work
- no good solution given
Comparing Java and C# Generics: http://www.jprl.com/Blog/archive/development/2007/Aug-31.html
Java Properties and C# properties are not the same thing at all: http://download.oracle.com/javase/1.4.2/docs/api/java/util/Properties.html
- C# properties are a value in the object
- Java properties are a way of saving the state to a file and reading it back
Another very nice Java/C# Comparison: http://www.harding.edu/fmccown/java_csharp_comparison.html
- This one would be best to read first
Java random number generation:
- generating a number in a range:
In doing Repast Simphony development, the RandomHelper class should be used:
- Don't be confused by some of the descriptions of how to do random number in earlier versions of Repast
- Use the RandomHelper
- http://repast.sourceforge.net/docs/reference/SIM/Random%20Numbers.html
- http://repast.sourceforge.net/docs/api/repastjava/repast/simphony/random/RandomHelper.html#RandomHelper()
- RandomHelper has only static methods.
- encapsulates the colt library's random number generation
- Very complicated
- used a uniform distribution by default
- can use
- Beta
- Binomial
- ChiSquare
- etc
- Wraps "Colt": http://acs.lbl.gov/software/colt/
A very nice example of a Java singleton implementation: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html
Default parameters in Java:
- http://stackoverflow.com/questions/965690/java-optional-parameters
- Doesn't really exist in Java
- http://stackoverflow.com/questions/997482/does-java-support-default-parameter-values
- can be done but is a bit ugly
Calling a constructor within a constructor in Java: http://stackoverflow.com/questions/285177/how-do-i-call-one-constructor-from-another-in-java
- this(); //without a parameter
Java coding style:
- http://geosoft.no/development/javastyle.html#Naming Conventions
- methods begin in lower case
Declaring generic arrays:
- http://forums.techarena.in/software-development/1117589.htm
- HashMap <?,?> [] x = new HashMap <?,?>[3];
- this work but I could access 'x'
- Best to avoid and wrap in a list instead
- List<HashMap<Class, Class> x = new ArrayList<HashMap<Class1, Class2>(3);
- the above code may not be correct, but it has the idea
C# ArgumentException can be changed to a Java IllegalArgumentException: https://forums.oracle.com/forums/thread.jspa?threadID=472866
Comparing Java and C# Generics: http://www.jprl.com/Blog/archive/development/2007/Aug-31.html
- performance advantages in C#
For each Loop in Java:
- http://download.oracle.com/javase/1,5.0/docs/guide/language/foreach.html
- for (List item : arrayList) { }
Generics and array construction in Java:
Comparison between Java HashMap and .NET Hastable: http://www.microsoft.com/mspress/books/sampchap/6173.aspx#116
Sorting a collection in Java: http://stackoverflow.com/questions/740299/how-do-i-sort-a-set-in-java
- List myList = new ArrayList (collection);
- Collections.sort (mylist);
No comments:
Post a Comment