Collections Framework – Real Time Examples and Assignments | Core Java Tutorial | Mr. Hari Krishna

///Collections Framework – Real Time Examples and Assignments | Core Java Tutorial | Mr. Hari Krishna

Collections Framework – Real Time Examples and Assignments | Core Java Tutorial | Mr. Hari Krishna

FavoriteLoadingAdd to favorites

Core Java Tutorial | Mr. Hari Krishna

Java468x60

** For Online Training Registration: β–Ί Call: +91-8179191999

Subscribe to our channel and hit the bell πŸ””πŸ””πŸ”” icon to get video updates.

πŸ’‘ Visit Our Websites
For Classroom Training:

For Online Training:

#corejava #javaTutorials #Tutorials #Training #corejavaVideos
————————–

πŸ’‘ About NareshIT:

β€œNaresh IT is having 14+ years of experience in software training industry and the best Software Training Institute for online training, classroom training, weekend training, corporate training of Hadoop, Salesforce, AWS, DevOps, Spark, Data Science, Python, Tableau, RPA , Java, C#.NET, ASP.NET, Oracle, Testing Tools, Silver light, Linq, SQL Server, Selenium, Android, iPhone, C Language, C++, PHP and Digital Marketing in USA, Hyderabad, Chennai and Vijayawada, Bangalore India which provides online training across all the locations

————————–

πŸ’‘ Our Online Training Features:
🎈 Training with Real-Time Experts
🎈 Industry Specific Scenario’s
🎈 Flexible Timings
🎈 Soft Copy of Material
🎈 Share Videos of each and every session.

————————–

πŸ’‘ Please write back to us at

πŸ“§ us.training@nareshit.com/ πŸ“§ online@nareshit.com or Call us at the USA: ☎+1404-232-9879 or India: ☎ +918179191999

————————–

πŸ’‘ Check The Below Links

β–Ί For Course Reg:
β–Ί Subscribe to Our Channel:
β–Ί Circle us on G+:
β–Ί Like us on Facebook:
β–Ί Follow us on Twitter:
β–Ί Follow us on Linkedin:
β–Ί Follow us on Instagram:

source

By |2019-10-30T23:36:40+00:00October 30th, 2019|Java Video Tutorials|49 Comments

49 Comments

  1. Naresh i Technologies October 30, 2019 at 11:36 pm - Reply

    Please Comment, Subscribe and Click BellπŸ””πŸ””πŸ”” Icon for More Updates. To learn software course from our experts please register here for online training: https://goo.gl/HIB0wL

  2. Laxman Reddy October 30, 2019 at 11:36 pm - Reply

    Tq sir…

  3. sandhaya upadhaya October 30, 2019 at 11:36 pm - Reply

    U r hero of java thankyou for ur explanation sir☺️☺️☺️☺️

  4. Ehsanul Karim October 30, 2019 at 11:36 pm - Reply

    Very usefull Video …clearly described …

  5. Azam Shaikh October 30, 2019 at 11:36 pm - Reply

    Hi Hari Sir,
    Its Awesome Explanation.

    // This is simple bike Example

    import java.util.ArrayList;
    import java.util.List;

    class Bike{

    int bikeNo;
    String bikeName;
    double bikePrice;

    Bike(int bikeNo, String bikeName, double bikePrice){
    this.bikeNo = bikeNo;
    this.bikeName = bikeName;
    this.bikePrice = bikePrice;
    }

    public String toString() {
    return bikeNo + " " + bikeName + " " + bikePrice ;
    }

    }

    class factory{

    private Bike bike;
    private List<Bike>list;

    factory(){
    list = new ArrayList<Bike>();
    }

    public void CreateBike(int bikeNo, String bikeName, double bikePrice) {
    bike = new Bike(bikeNo, bikeName, bikePrice);
    list.add(bike);
    }
    public List<Bike>geBikeslist(){
    return list;
    }

    }

    public class Showroom {
    public static void main(String args[]) {

    factory factory = new factory();
    factory.CreateBike(1, "Activa", 45000);
    factory.CreateBike(2, "Honda Bike", 65000);
    factory.CreateBike(3, "Maestro", 50000);

    List<Bike>list=factory.geBikeslist();
    for(Bike bike : list) {
    System.out.println(bike);
    }
    }

    }

    // this is Employee Example

    import java.util.ArrayList;
    import java.util.List;

    class Employee{
    int empNo ;
    String empName ,job;
    double salary;

    Employee(int empNo, String empName, String job, double salary){
    this.empNo=empNo;
    this.empName=empName;
    this.job=job;
    this.salary=salary;
    }

    public String toString() {
    return empNo + " " + empName + " " + job + " " + salary ;
    }
    }

    class Company{

    private Employee employee;
    private List<Employee>list;

    Company(){
    list=new ArrayList<Employee>();
    }

    public void createEmployee(int empNo, String empName, String job, double salary) {
    employee = new Employee(empNo, empName, job, salary);
    list.add(employee);
    }

    public List<Employee>getEmployeesList(){
    return list;

    }
    }

    public class FrontOffice {
    public static void main(String args[]) {

    Company company = new Company();
    company.createEmployee(101, "Azam", "Software Engineer", 25000);
    company.createEmployee(102, "Khalid", "Android Developer", 20000);
    company.createEmployee(103, "Manzar", "Data Analyst", 30000);

    List<Employee>list=company.getEmployeesList();
    for(Employee emp:list) {
    System.out.println(emp);
    }
    }
    }

  6. annapurna durga October 30, 2019 at 11:36 pm - Reply

    Sir u did a wonderful job

  7. Pravin khawse October 30, 2019 at 11:36 pm - Reply

    A very nice and Thorough Explanation!!! hats off to HK sir

  8. S Bera October 30, 2019 at 11:36 pm - Reply

    Amazing teacher…….thank you so much sir.

  9. sitelev October 30, 2019 at 11:36 pm - Reply

    Thank you for great explanation!

  10. Maria Clarissa Yago October 30, 2019 at 11:36 pm - Reply

    the best πŸ™‚

  11. Runubala Sutar October 30, 2019 at 11:36 pm - Reply

    Sir its really awesome .sir I develop this real time example its working thank you sir

  12. nivedita October 30, 2019 at 11:36 pm - Reply

    Thank you sir this is again revision on classes

  13. David kanthi October 30, 2019 at 11:36 pm - Reply

    import java.util.*;

    class FrontOffice{
    public static void main(String argsp[]){

    Scanner sc = new Scanner(System.in);
    System.out.println("Enter the number of Employees");
    short emp = sc.nextShort();
    ArrayList<Employee> al = new ArrayList<Employee>();
    Company c = new Company();

    for(int i =0 ; i<emp; i++){

    Employee e = new Employee();
    System.out.println("nEnter Employee id: ");
    e.eid = sc.nextShort();
    System.out.println("nEnter Employee name: ");
    e.ename = sc.next();
    System.out.println("nEnter Employee address: ");
    e.eadd = sc.next();

    al.add(e);

    }
    c.addEmp(al);
    }
    }

    class Company{

    ArrayList<Employee> employees = new ArrayList<Employee>();

    public void addEmp(ArrayList<Employee> al){

    for(Employee e: al){
    employees.add(e);
    e.printEmployee();
    }
    }
    }

    class Employee{
    short eid;
    String ename;
    String eadd;

    public void printEmployee(){
    System.out.println("Employee id: "+this.eid+", name: "+this.ename+", address: "+this.eadd);
    }
    /**
    Employee(short eid, Stirng ename, String eadd){
    this.eid = eid;
    this.ename= ename;
    this.eadd = eadd;
    }
    */
    }

  14. venkateswarlu panyam October 30, 2019 at 11:36 pm - Reply

    Awesome Sir, amazing points and clean and clear explanation among real time examples. Hands up Sir. I have missed before and wasted my time. Thank you so much.

  15. MOIN KHAN MEWATI October 30, 2019 at 11:36 pm - Reply

    the first rule of teaching is that you have to connect wid the students so that they correlate wid topic and you are master in that
    the way you explain the topic is simply amazing.thanks sir for making collection so easy i hope one day i m also master in collection only bcoz of you

  16. Sumit Dhamanekar October 30, 2019 at 11:36 pm - Reply

    Hi sir i started to learn java now days i learn io stream in your videos thats really good. in collection framework there are lots of problems are occur during the learning process but your videos are there then it feels easy to understand. Thanks once again sir.

  17. NkSourceGuide Madheshya October 30, 2019 at 11:36 pm - Reply

    sir ,before 30 minutes I just ignore to learn about the concept of collections Framework but yet I feel it's very important. ..☺
    easy also

  18. Sheetal Joshi October 30, 2019 at 11:36 pm - Reply

    Thank you so much sir… In vry easy way u taught….. Excellent sir…

  19. MD Anash Ansari October 30, 2019 at 11:36 pm - Reply

    Thanks, sir, for making Collections Topic more interesting

  20. Truth Lover October 30, 2019 at 11:36 pm - Reply

    Great, Explained very beautifully.

  21. Chidanand muthuganne doddaiah October 30, 2019 at 11:36 pm - Reply

    Tumba chennagide adhbutavagide sir..istu chennagi yaaru teach maadalla

  22. spoon reev October 30, 2019 at 11:36 pm - Reply

    To burn this knowledge in your neurons, first watch Durga, then come back here, even in your death you will be coding collections…thank me later..

  23. vinal bagaria October 30, 2019 at 11:36 pm - Reply

    Awesome sir😍😍

  24. kvkmtech October 30, 2019 at 11:36 pm - Reply

    very good job by Naresh I Technologies

  25. lakshmi pandugula October 30, 2019 at 11:36 pm - Reply

    Really super explanation sir

  26. Reecha sood October 30, 2019 at 11:36 pm - Reply

    Assignment Code is written bellow:
    package collectionInJava;

    public class Employee {
    private String firstName;
    private String middleName;
    private String lastName;
    private String address;

    public Employee(String firstName, String middleName, String lastName, String address) {
    this.firstName = firstName;
    this.middleName = middleName;
    this.lastName = lastName;
    this.address = address;

    }

    public void setFirstName(String firstName) {
    this.firstName = firstName;
    }

    public String getFirstName() {
    return firstName;
    }

    public void setMiddleName(String middleName) {
    this.middleName = middleName;
    }

    public String getMiddleName() {
    return middleName;
    }

    public void setLastName(String lastName) {
    this.lastName = lastName;
    }

    public String getLastName() {
    return lastName;
    }

    public void setAddress(String address) {
    this.address = address;
    }

    public String getAddress() {
    return address;
    }
    }
    package collectionInJava;

    import java.util.ArrayList;

    public class FrontOffice {
    // public static void main(String[] args) {
    // TODO Auto-generated method stub

    public ArrayList<String[]> sendEmployeeInfo() {
    ArrayList<String[]> employeeInfo = new ArrayList<>();

    String[] empployee1 = new String[] { "Mahesh", "Kumar", "Sood", "Hoshiarpur" };
    String[] empployee2 = new String[] { "Mahesh1", "Kumar1", "Sood1", "Hoshiarpur1" };
    String[] empployee3 = new String[] { "Mahesh2", "Kumar2", "Sood2", "Hoshiarpur2" };
    String[] empployee4 = new String[] { "Mahesh3", "Kumar3", "Sood3", "Hoshiarpur3" };
    employeeInfo.add(empployee1);
    employeeInfo.add(empployee2);
    employeeInfo.add(empployee3);
    employeeInfo.add(empployee4);
    return employeeInfo;
    }
    }
    package collectionInJava;

    import java.util.ArrayList;

    public class Company {

    public static void main(String[] args) {

    FrontOffice fO = new FrontOffice();
    ArrayList<String[]> employeeInfo = fO.sendEmployeeInfo();
    ArrayList<Employee> addEmployeeInfo = new ArrayList<>();

    for (int j = 0; j < employeeInfo.size(); j++) {
    addEmployeeInfo.add(new Employee(employeeInfo.get(j)[0], employeeInfo.get(j)[1], employeeInfo.get(j)[2],
    employeeInfo.get(j)[3]));

    }
    for (int i = 0; i < addEmployeeInfo.size(); i++) {
    System.out.println(addEmployeeInfo.get(i).getFirstName());
    System.out.println(addEmployeeInfo.get(i).getMiddleName());
    System.out.println(addEmployeeInfo.get(i).getLastName());
    System.out.println(addEmployeeInfo.get(i).getAddress());

    }

    }
    }

  27. Noman Ibrahim October 30, 2019 at 11:36 pm - Reply

    // My Domain class
    class Employee{
    ——- – — —
    — — — — — —
    }
    //My DAO calss
    class EmployeeDao{
    public List<Employee> findallEmployee(String departmentName){
    String sql = "SELECT employeeName, employeeId FROM employee WHERE departmetName='?'";
    // after executing the query there is a possibilities that it retaurns unknown number of empoyee object

    }
    }
    // My service class
    class Employee service {

    public static void main(Strings [] args){
    EmployeeDao empl= new EmployeeDao();
    List<Employee> l = empl.findallEmployee("Game");

    }
    }

  28. Sai Amarendra October 30, 2019 at 11:36 pm - Reply

    I understand very well

  29. Pintu Gupta October 30, 2019 at 11:36 pm - Reply

    Well explained sir..

  30. Slobodan Tajisic October 30, 2019 at 11:36 pm - Reply

    Create java project SecondApplication with three java files :

    Employee java file:

    package secondapplication;

    public class Employee {

    String firstName;
    String secondName;
    int age;
    String department;

    public Employee(String firstName, String secondName, int age, String department) {
    this.firstName = firstName;
    this.secondName = secondName;
    this.age = age;
    this.department = department;
    }
    }

    FirstApplication java file :

    package secondapplication;

    import java.util.ArrayList;

    public class FirstApplication{

    private ArrayList<Employee> employees = new ArrayList();

    public FirstApplication() {

    Employee e1 = new Employee("Slobodan", "Tajisic", 40, "HR");
    Employee e2 = new Employee("Hari", "Krishna", 28, "IT");
    Employee e3 = new Employee("Cristiano", "Ronaldo", 33, "Juventus");
    Employee e4 = new Employee("Quentin", "Tarantino", 55, "Movie");

    employees.add(e1);
    employees.add(e2);
    employees.add(e3);
    employees.add(e4);
    }

    public static void main(String[] args) {
    FirstApplication fa = new FirstApplication();
    ArrayList<Employee> emps = fa.getEmployees();
    System.out.println("Employees :n");
    for(Employee e : emps){
    System.out.println(e.firstName + " " + e.age + " years");
    }
    System.out.println(" ");
    }

    public ArrayList<Employee> getEmployees() {
    return employees;
    }
    }

    SecondApplication java file :

    package secondapplication;

    import java.util.ArrayList;

    public class SecondApplication{

    public static void main(String[] args) {

    FirstApplication fa = new FirstApplication();
    ArrayList<Employee> emps = fa.getEmployees();
    System.out.println("Employees :n");
    for(Employee e : emps){
    System.out.println(e.firstName + " " + e.secondName);
    }
    System.out.println(" ");

    }

    }

    Now, run file SecondApplicaton….Or run file FirstApplication…

  31. R P October 30, 2019 at 11:36 pm - Reply

    sir,you are like Aamir khan in Taare zameen par movie iam like dull student darsheel safary(ishaan)πŸ˜…even though iam understanding, i had ever met a faculty like you for javaπŸ‘Œ

  32. sachin rath October 30, 2019 at 11:36 pm - Reply

    hello friends can any one complete the task employee detils transfer from one java applicaion if any one hv done please send in comment section

  33. tanish gupta October 30, 2019 at 11:36 pm - Reply

    1. Office.java

    package com.employee;

    import java.util.ArrayList;

    public class Office {

    public static void main(String[] args) {

    Company cd=new Company(2);

    cd.createEmployee("Tanish",100000,"t100");

    cd.createEmployee("Anuj",100000,"a100");

    ArrayList al2=cd.getEmpData();

    System.out.println(al2.get(0));

    System.out.println(al2.get(1));
    }

    }

    2. Company.java

    package com.employee;

    import java.util.ArrayList;

    public class Company {

    int size=0;

    ArrayList al=null;

    public Company(int size) {

    this.size=size;

    al=new ArrayList<>();

    }

    void createEmployee(String ename,int esal,String eid){

    Employee e1=new Employee(ename, esal, eid);

    al.add(e1);

    }

    ArrayList getEmpData(){

    return al;

    }

    }

    3. Employee.java

    package com.employee;

    public class Employee {

    private String ename;

    private int esal;

    private String eid;

    public Employee(String ename,int esal,String eid) {

    this.setEname(ename);

    this.setEid(eid);

    this.setEsal(esal);

    }

    public String getEid() {

    return eid;

    }

    public void setEid(String eid) {

    this.eid = eid;

    }

    public int getEsal() {

    return esal;

    }

    public void setEsal(int esal) {

    this.esal = esal;

    }

    public String getEname() {

    return ename;

    }

    public void setEname(String ename) {

    this.ename = ename;

    }

    @Override

    public String toString() {

    return "Ename= "+getEname()+"nEsal= "+getEsal()+"nEid= "+getEid();

    }

    }

  34. dipesh rana October 30, 2019 at 11:36 pm - Reply

    Thak you so much sir…

  35. Lilima Priyadarsini Prusty October 30, 2019 at 11:36 pm - Reply

    Great explanation sir…. Hats off!!

  36. Sagar Goswami October 30, 2019 at 11:36 pm - Reply

    the video is good, it would be awesome if the audio quality was good. anyways Cheers.:)

  37. BackBenchers Production October 30, 2019 at 11:36 pm - Reply

    import java.util.*;
    class Company
    {
    Scanner sc = new Scanner(System.in);
    ArrayList<Employee> al = new ArrayList();
    ArrayList setDetails()
    {
    for(int i=0;i<4;i++)
    {
    Employee e = new Employee();
    System.out.println("Enter employee name");
    e.name = sc.next();
    System.out.println("Enter employee id");
    e.id = sc.nextInt();
    System.out.println("Enter employee profile");
    e.profile = sc.next();
    al.add(e);
    }
    return al;
    }

    }
    class Employee{
    int id;
    String name;
    String profile;

    }
    class Demo
    {
    public static void main(String args[])
    {
    Company c = new Company();
    ArrayList<Employee> ar =c.setDetails();
    //Iterator it = ar.iterartor();
    for(Employee e:ar)
    {
    System.out.println(e.name+"t"+e.id+"t"+e.profile);
    }

    }
    }

  38. The Versatile Sidd October 30, 2019 at 11:36 pm - Reply

    nice explanation and life example too

  39. mohmed yususf October 30, 2019 at 11:36 pm - Reply

    Thank you Sir , Really It was amazing , I'm from Sudan and i am one of your students from 11 am batch , I like your explanation , you helped me a lot with this tough topic .

  40. Bruce Wayne October 30, 2019 at 11:36 pm - Reply

    Sir can you please give me the Assignment code..Thank u for your outstanding explanation of collecton framework..

  41. Kanakaraju Karre October 30, 2019 at 11:36 pm - Reply

    Hari Sir is a Great Teacher, if you are layman blindly go to Hari to learn JAVA.

  42. chandan pandey October 30, 2019 at 11:36 pm - Reply

    no one can teach like natraj sir and hari krishna sir..no words for you sir ..thanks in my bottom of my heart…I LOVE YOU sir

  43. Clevy N October 30, 2019 at 11:36 pm - Reply

    I understood this topic very clearly.

  44. Clevy N October 30, 2019 at 11:36 pm - Reply

    I got what I wanted actually after long time . . Thank you so much sir.

  45. Keerthichandra C October 30, 2019 at 11:36 pm - Reply

    Could you please give a brief explanation what happens in Bike.java class? I believe here bike properties will created like CC, horse power and other. Am I right ?

  46. rahul October 30, 2019 at 11:36 pm - Reply

    thank u sir for amazing example of add to cart

  47. Raju Goud October 30, 2019 at 11:36 pm - Reply

    superb sir thank you πŸ™‚

  48. kiran kumar October 30, 2019 at 11:36 pm - Reply

    Hi Hari Sir,
    Thank You very much for your real time example on collection framework.
    I have Developed the code according your requirement and its working.

    import java.util.ArrayList;
    import java.util.List;

    public class FrontOfficePeople {

    public static void main(String[] args) {

    Company company = new Company();

    company.createEmployee(101, "Hari", 50000, "Software Engg");
    company.createEmployee(102, "Naresh", 40000, "Manager");
    company.createEmployee(103, "Mahesh", 30000, "Testing Engg");
    company.createEmployee(104, "Kiran", 35000, "Java Developer");

    List<Employee> list = company.getEmployeesList();

    for (Employee emp : list) {
    System.out.println(emp);
    }

    }

    }

    class Employee {

    private int empNo;
    private String empName;
    private int salary;
    private String job;

    public Employee(int empNo, String empName, int salary, String job) {
    this.empNo = empNo;
    this.empName = empName;
    this.salary = salary;
    this.job = job;
    }

    public String toString() {
    return empNo + " " + empName + " " + salary + " " + job;
    }

    }

    class Company {
    private Employee employee;
    private List<Employee> list;

    public Company() {
    list = new ArrayList<Employee>();
    }

    public void createEmployee(int empNo, String empName, int salary, String job) {
    employee = new Employee(empNo, empName, salary, job);
    list.add(employee);
    }

    public List<Employee> getEmployeesList() {
    return list;
    }

    }

  49. Pradip Chavan October 30, 2019 at 11:36 pm - Reply

    Very good videos of collection framework. I helps lot. Sir can plz uploaded more remaining collection framework videos, as these uploaded videos are not completely for collection framework?
    Can you plz upload all collection videos?
    Also send me some assignment on my email chavanpradip82@gmail.com

Leave A Comment

*