This file contains hidden or 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
| /** | |
| * Created by mac on 08/04/17. | |
| */ | |
| public class Student { | |
| private int studentId; | |
| private String firstName; | |
| private String lastName; | |
| public Student(int studentId, String firstName, String lastName) { | |
| this.studentId = studentId; |
This file contains hidden or 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
| import lombok.Builder; | |
| import lombok.Data; | |
| import java.util.List; | |
| /** | |
| * Created by mac on 08/04/17. | |
| */ | |
| @Data //Getter, Setter, RequiredArgsConstructor, EqualsAndHashCode, ToString | |
| @Builder |
This file contains hidden or 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
| import lombok.Builder; | |
| import lombok.Data; | |
| import java.util.List; | |
| /** | |
| * Created by mac on 08/04/17. | |
| */ | |
| @Data | |
| @Builder |
This file contains hidden or 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
| import lombok.Builder; | |
| import lombok.Data; | |
| /** | |
| * Created by mac on 08/04/17. | |
| */ | |
| @Data | |
| @Builder | |
| public class Student { | |
| private int studentId; |
This file contains hidden or 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
| public class NotCoolRunner { | |
| public static void main(String[] args) { | |
| // Not Cool :( | |
| Student s1 = new Student(1, "vasu", "babu"); | |
| Student s2 = new Student(2, "Hari", "panu"); | |
| Student s3 = new Student(3, "John", "Noble"); | |
| Student s4 = new Student(4, "James", "bond"); | |
| Branch b1 = new Branch(101, "CSE", asList(s1, s2)); | |
| Branch b2 = new Branch(102, "MECH", asList(s2, s3)); |
This file contains hidden or 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
| public class CoolRunner { | |
| public static void main(String[] args) { | |
| // Not Cool :( | |
| Student s1 = Student.builder().studentId(1).firstName("vasu").lastName("babu").build(); | |
| Student s2 = Student.builder().studentId(2).firstName("Hari").lastName("panu").build(); | |
| Student s3 = Student.builder().studentId(3).firstName("John").lastName("Noble").build(); | |
| Student s4 = Student.builder().studentId(4).firstName("James").lastName("bond").build(); | |
| Branch b1 = Branch.builder().branchId(101).branchName("CSE").students(asList(s1, s2)).build(); | |
| Branch b2 = Branch.builder().branchId(102).branchName("MECH").students(asList(s3, s4)).build(); |
This file contains hidden or 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 main | |
| import ( | |
| "fmt" | |
| ) | |
| func main() { | |
| arr := []int{1, 2, 3, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9} | |
| limit := 5 |
This file contains hidden or 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
| [ | |
| { | |
| "id": "1", | |
| "type": "Social Media", | |
| "path": "1" | |
| }, | |
| { | |
| "id": "2", | |
| "type": "Messenger", | |
| "path": "1.2" |
This file contains hidden or 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 main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| "unsafe" | |
| ) | |
| func main() { | |
| var a []int |
This file contains hidden or 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 main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| "unsafe" | |
| ) | |
| func main() { | |
| a := make([]int, 0, 10) //returns a new array with length 0 and a capacity of 10 |
OlderNewer