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 com.learn.dbhakuni.ds; | |
import java.util.Arrays; | |
import java.util.Collections; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: dbhakuni | |
* Date: 31/8/14 | |
* Time: 12:35 PM |
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 com.learn.dbhakuni.ds; | |
import java.util.Arrays; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: dbhakuni | |
* Date: 31/8/14 | |
* Time: 5:27 PM | |
* To change this template use File | Settings | File Templates. |
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 com.learn.dbhakuni.ds; | |
import java.util.Arrays; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: dbhakuni | |
* Date: 28/9/14 | |
* Time: 10:04 PM | |
* To change this template use File | Settings | File Templates. |
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 com.digvijayb.learning.concurrency; | |
import java.util.concurrent.ArrayBlockingQueue; | |
import java.util.concurrent.BlockingQueue; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import java.util.concurrent.atomic.AtomicInteger; |
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 com.digvijayb.aglorithms.pattern.creation; | |
/** | |
* Created by digvijayb on 9/3/15. | |
*/ | |
//Builder Pattern | |
public class Product { | |
private final String name; | |
private final String description; |
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
class BuilderClient{ | |
public static void builderClient(){ | |
/** | |
* Some Code | |
*/ | |
Product.Builder builder = new Product.Builder("iPhone5", "iPhone 5C", 499.90);//fill in the required field | |
builder.brand("apple").maxRetialPrice(699.99);//chaining is done as it return itself | |
Product iPhone = builder.build(); // building the immutable object of product iphone | |
/** | |
* Some Code that use iPhone object |
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 com.digvijayb.aglorithms.pattern.creation; | |
/** | |
* Created by digvijayb on 9/3/15. | |
*/ | |
public class ClientCB { | |
public static void builderClient(){ |
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
How to create immutable class | |
========================= | |
**Immutable Classes** are those who's object once created it can't be change (or value can't change). So to create **Immutable Class** in java there are some simple that are listed below. | |
> **Rules for immutable class:** | |
> - No **setter** should provide for the field. |
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 com.dgstack.dev.vo; | |
/** | |
* @author digvijayb | |
* | |
*/ | |
public class UserVO { | |
public UserVO() { | |
} |
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 com.dgstack.dev; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.util.ArrayList; | |
import java.util.List; | |
import javax.xml.namespace.QName; | |
import javax.xml.stream.XMLEventReader; | |
import javax.xml.stream.XMLInputFactory; |