String val = “vvk”;
val+”singh”;
System.out.println(val); // outputs vvk — immutabilityStringBuffer valB = new StringBuffer(“vvk”);valB.append(“singh”);System.out.println(valB); // outputs vvksingh — mutabiliity
a,b are passed as parameters
add(a,b).subtract(a).divide(a) //Consider these are predefined functions in any FP
class Test {   public void calculate(a,b) {     int c = add(a,b)     int d = subtract(c,a)     int f = divide(d,a)     print(f)   }}
test.calculate(a,b)
L1 = 1 -> 2 → 3
L2 = 4 -> 5 -> 6
1 -> 2 -> 3 -> 4 -> 5 -> 6
List<Integer> list = Arrays.asList(1,2,3,4,5)
list.stream().map(number -> number*2).forEach(System.out::println); // prints 1,4,6,8,10
System.out.println(list) // prints 1,2,3,4,5

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store