How to Sort Date in String Array?

Mostly Ask Interview Question

Sorting String Date ..

OutPut:-

5-2-2013,
23-8-2014,
5-11-2014

Permutation of String in Java Algorithm

To get all the permutations, we will first take out the first char from String and permute the remaining chars.
If String = “ABC”
First char = A and remaining chars permutations are BC and CB.
Now we can insert first char in the available positions in the permutations.
BC -> ABC, BAC, BCA
CB -> ACB, CAB, CBA

So we can write a recursive function call to return the permutations and then another function call to insert the first characters to get the complete list of permutations.

Note that I have used SET to remove duplicates, so that it works for those strings also having same chars.

Here is the output of the above program:

How To Count the number of Repeated String inside the paragrap?

Here the example of Count repeated string in java

Output:- 2

Convert String into Title Case Using Java

There are no capitalize() or titleCase() methods in String class. You have two choices:

  • Using Apache Commons lang string utils.
  • write (yet another) static helper method toTitleCase()

 

Using Apache Commons lang string utils.

Apache Commons StringUtils.capitalize() or WordUtils.capitalize()

example:

From WordUtils doc

Sample Implementation

OutPut


String
Another String
YET ANOTHER STRING

Pagination with Hibernate using HQL

At this point we can look at a complete example for pagination, where we are calculating the last page and then retrieving it:

If You have any Query Please Commnet or Live Chat Option avilable

How To Disable Auto Complete, Cut, Copy, Paste in input feild using JQuery?

Disable Auto Complete, Cut, Copy, Paste in input feild

Click Here For Demo

 

Jquery

How To Find Max Date InArrayList in java?

How To Convert Java Date into String Using JavaScript?

Check out the Example:-

Download file here :- https://github.com/faizakram/ConvertJavaDateToStringUsingJavaScript

How to Sum Values From Specific Field Of The Objects In a List. Java 8

Now, how can I find in Java8 with streams the sum of the values of the int fields field from the objects in list lst under a filtering criterion

(e.g. for an object o, the criterion is o.field > 10)?

Suppose to have a class Abc