It shows just one of the operations that might depend on the type of employee.
public Money calculatePay(Employee e) throws InvalidEmployeeType { switch (e.type) { case COMMISSION: return calculateCommissionPay(e); case HOURLY…
Here an example of J2SE 5.0 Enhanced for Loop by one of my old colleague:
This code maybe will run faster.
https://gist.github.com/fabiolee/8676ef6894cf0adb64c253d8d5c4840b.jsThese two set of codes seem like having no different. It seem like “return” make “else if” useless.
Hehe, another Microsoft & Java comparison.Overall, both of them having a quite complete framework which let developers easy to develop web application.ASP.NET 2.0 & Apache Struts framework comparison:1) .NET Master Page = Struts Tiles Definition…
I found this cache problem during my development. Example of how this problem can be happen:https://gist.github.com/fabiolee/1e32db8fe65182cd96f95c05d6d54fc2.jsIf these two java files compiled into class files previously, then we might need to be careful when changing the “planId”…
Here is some trick to let the code run faster, I face this long time ago, finally I am able to write it down.For CodeA & CodeB:https://gist.github.com/fabiolee/796035fd617a0f8b4669e107d8a1ec6e.jsThe different will be very big when the String Array gone larger. If let say the size of the…