Since Java has introduced lambda, writing code has become a breeze especially when it comes to expressing what you want to computer to do rather than how to do it. The following is a question from Project Euler and is solved using lambdas in Java8.

It exactly matches the list of 3 things that we made to solve the problem. It iterates from 2 to 10000 and checks if the number is amicable and adds it, without the boilerplate. This style when applied to enterprise level applications makes them low maintenance and one can easily map the code to requirements.
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220. Evaluate the sum of all the amicable numbers under 10000.
A simple brute force solution is to check every number from 2 to 10000 and if its an amicable number then add it to sum. Listing it in steps you are basically doing 3 things:
- Take numbers from 2 to 10000
- If number is amicable
- Add it

It exactly matches the list of 3 things that we made to solve the problem. It iterates from 2 to 10000 and checks if the number is amicable and adds it, without the boilerplate. This style when applied to enterprise level applications makes them low maintenance and one can easily map the code to requirements.
Really nice blog,i enjoyed your infomations. Thank you and i will expect more in future.
ReplyDeleteJAVA Training in Chennai
Java training institute in chennai
Selenium Training in Chennai
Hadoop Training in Chennai
Python Training in Chennai
Software testing training in chennai
JAVA Training in Chennai
Java Training in Velachery
The article is so informative. This is more helpful for our
ReplyDeletemagento training course in chennai
magento training institute in chennai
magento 2 training in chennai
magento development training
magento 2 course
magento developer training
Thanks for sharing.
Aivivu chuyên vé máy bay, tham khảo
ReplyDeleteve may bay di my gia re
vietnam airlines quốc tế
vé máy bay từ đức về sài gòn
giá vé máy bay từ moscow về hà nội
giá vé máy bay từ anh về việt nam
lịch bay từ pháp về việt nam
danh sách khách sạn cách ly tại quảng ninh
Aivivu chuyên vé máy bay, tham khảo
ReplyDeletegiá vé máy bay đi Mỹ khứ hồi
lịch bay từ mỹ về việt nam
vé máy bay vietjet từ nhật về việt nam
đặt vé máy bay từ đức về việt nam
vé máy bay giá rẻ từ Canada về Việt Nam
đặt vé máy bay từ hàn quốc về việt nam
giá khách sạn cách ly ở việt nam
Great Article android based projects
ReplyDeleteJava Training in Chennai Project Center in Chennai Java Training in Chennai projects for cse The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training Project Centers in Chennai