jdbc:mysql://localhost:3306/databasename??useUnicode=true&characterEncoding=utf-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package interviewprograms; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Set; | |
public class FindTheDuplicates { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var formData = new FormData(); | |
$.ajax({ | |
url : "${url}", | |
type : "POST", | |
contentType : false, | |
/* enctype: "multipart/form-data", */ | |
processData : false, | |
data : function() { | |
var inputs = $('#formObject').serializeArray(); | |
console.log("-----------------Sending " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package singleton; | |
public class ThreadSafeSingleton { | |
//1.private Constructor | |
private ThreadSafeSingleton() { | |
} | |
//2.Only Instance of the Class | |
private static ThreadSafeSingleton instance = new ThreadSafeSingleton(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package singleton; | |
public class LazyInitialization { | |
//1.private Constructor | |
private LazyInitialization() { | |
} | |
//2.Only Instance of the Class | |
private static LazyInitialization instance = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package singleton; | |
public class StaticBlockInitialization { | |
private StaticBlockInitialization(){} | |
//1.private Constructor | |
static{ | |
try{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package singleton; | |
public class EagerInitialization { | |
//1.private Constructor | |
private EagerInitialization() { | |
} | |
//2.Only Instance of the Class | |
private static final EagerInitialization instance = new EagerInitialization(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static final String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | |
static SecureRandom rnd = new SecureRandom(); | |
public static String randomString( int len ){ | |
StringBuilder sb = new StringBuilder( len ); | |
for( int i = 0; i < len; i++ ) | |
sb.append( AB.charAt( rnd.nextInt(AB.length()) ) ); | |
return sb.toString(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ObjectMapper mapper = new ObjectMapper(); | |
List<MaterialRequestSubFO> materialLst = mapper | |
.readValue(data, TypeFactory.defaultInstance() | |
.constructCollectionType(List.class, MaterialRequestSubFO.class)); | |
System.out.println("Lst Size---->"+materialLst.size()); |
NewerOlder