2014年3月7日

Maintainable HashCode and Equals Using Apache Commons

摘要: Java hashCode and equals methods can be tricky to implement correctly. Fortunately, all majors IDEs allow generating them. For example, this is how they look like for a class with two attributes when generated in Eclipse:123456789101112131415161718192021222324252627282930@Overridepublic int hashCode 阅读全文

posted @ 2014-03-07 09:18 Step-BY-Step 阅读(205) 评论(0) 推荐(0) 编辑

Multiples of 3 and 5

摘要: 1 --If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. 2 --Find the sum of all the multiples of 3 or 5 below 1000. 3 4 --set up iterator 5 function list_iter() 6 local i = 1; 7 local n = 100; 8 return functi... 阅读全文

posted @ 2014-03-07 07:22 Step-BY-Step 阅读(255) 评论(0) 推荐(0) 编辑

Even Fibonacci numbers

摘要: 1 --Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 2 --1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... 3 --By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of. 阅读全文

posted @ 2014-03-07 07:20 Step-BY-Step 阅读(228) 评论(0) 推荐(0) 编辑

导航