Giter VIP home page Giter VIP logo

collection-maps-example's Introduction

collection-maps-example

Github Pages URL https://mullanishah.github.io/collection-maps-example/


An assignment/task/example illustrating functionalities and usages provided by Map implementation class ie. HashMap in Java.

In a nutshell, Collection framework provides utility classes and interfaces that are readymade implementation of various data structures and algorithms. Whereas, Map interface implementation classes stores elements in key/value pair.

In this example, I have tried to utilise capabilities and functions provided by HashMap class in the Collection framework. Here I have considered an imaginary Customer management system with features such as register, sort and unsubscribe customers. This is a plain old Core Java application without any database, threading or file handling functionalities; intended to keep focus purely on Collection framework.

In order to execute the application, run MainTester class from com.core.tester package. Upon program execution, user will be asked to select appropriate option from the list of Menus to perform following operations:

Map class method used
1) Register new customer (HashMap.put(K,V))
2) Unsubscribe existing customer (HashMap.remove(K))
3) Update password (HashMap.get(K) and HashMap.set(K, V))
4) Display all customers (HashMap.values() and Collection.iterator())
5) Sort customers (on Email) (Natural sorting, Comparable interface)
6) Sort customers (on Date of Birth) (Custom Sorting, Comparator interface)

Output:

### MENU ###
1.Register new customer     2.Unsubscribe existing 
3.Update password           4.Display details 
5.Sort(On Email)            6.Sort(on DoB) 
7.Exit
Enter your choice: 
1
Enter details (email, name, pwd, b'date(dd/MM/yyyy), reg.amount): 
dave.watson@hotmail
Davee Watson
*******
12/04/1988
13005
New customer registered successfully!!
==================================
### MENU ###

1.Register new customer     2.Unsubscibe existing 
3.Update password           4.Display details 
5.Sort(On Email)            6.Sort(on DoB) 
7.Exit
Enter your choice: 
2
Enter email id: 
test@gmail
Customer details removed successfully!!, 
details: test[Email: test@gmail, Pwd: 123456, B'Date: 09/09/1999, RegAmount: Rs.15000.0]
==================================
### MENU ###

1.Register new customer     2.Unsubscibe existing 
3.Update password           4.Display details 
5.Sort(On Email)            6.Sort(on DoB) 
7.Exit
Enter your choice: 
6
==================================
Sorted on DoB: 
17/10/1984 | Mrs Alice Smith[Email: [email protected], Pwd: Alice@1234, B'Date: 17/10/1984, RegAmount: Rs.11090.0]
31/05/1987 | Sir Paul McKellen[Email: [email protected], Pwd: paul@1234, B'Date: 31/05/1987, RegAmount: Rs.9210.0]
12/04/1988 | Davee Watson[Email: dave.watson@hotmail, Pwd: dave@123, B'Date: 12/04/1988, RegAmount: Rs.13005.0]
21/01/1988 | David Darwin[Email: [email protected], Pwd: david@123, B'Date: 21/01/1988, RegAmount: Rs.11200.0]
09/09/1989 | A R Beevers[Email: [email protected], Pwd: AR1234, B'Date: 09/09/1989, RegAmount: Rs.17590.0]
06/08/1990 | Sean Bean[Email: [email protected], Pwd: Sean@1234, B'Date: 06/08/1990, RegAmount: Rs.14590.0]

Thank you.
Shahrukh Mullani

collection-maps-example's People

Contributors

mullanishah avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.