Java is computer programming language with multi-paradigm of programming Object-oriented, structured, imperative, concurrent and others desgined and created by James Glosling and his team at Sun microsystems. Released in 1995 with its promised “Write Once, Run Anywhere” now after 21 years of initial reslease in 2016 Java is one of the most popular programming languages in use particularly for client-server web applications, with a reported 9 million developers.
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.
Mustache.js is very popular templating js for web. Today we going to look at java version of mustache.
So for getting started we need a file which will act like a template for our program. For this we a file template.mustache which is simple text for a mail with some place holder in mustache syntax.
There are number of creational patterns which are use to create instances of class, but were builder pattern fit in and stand out from other creational pattern like static factory, telescoping constructor, javabean pattern and other’s. Is its ability to scale with a large number of parameters. So let’s get started with an example.
Let’s consider a case where we have to create object of a Product class with several field like name, description, sellPrice, costPrice, maxRetailPrice, discount and brand. For selling a product name, sellPrice and description are mandatory field, a product object is incomplete without these three information.So we are going to implement builder pattern in this case to incur the problem.
Instead of making the desired object directly, the client calls a constructor (or static factory) with all of the required parameters and gets a builder object. Then the client calls setter-like methods on the builder object to set each optional parameter of interest. Finally, the client calls a parameterless build method to generate the object, which is immutable. The builder is a static member class of the class it builds.
PEP(Python Enhancement Proposal)-20 is the Zen of Python. Written by long time Python developer Tim Peters, the Zen is acknowledged as the core philosophy of Python. In fact, it is always accessible in any Python environment by using import this:
Two of the coolest framework in java Jersey and Spring. we are going to integrate together to get best of the both for our restful web service. Jersey provides the JAX-RS API’s implementation to get web service structure ready. And spring logical support to our web service by it unique feature inversion of control (IoC)
Jersey RESTful Web Services framework is open source, production quality, framework for developing RESTful Web Services in Java that provides support for JAX-RS APIs and serves as a JAX-RS (JSR 311 & JSR 339) Reference Implementation.
The Spring Framework is an open source application framework and inversion of control container for the Java platform.
Technology Stack
The Interface Iterator provider as three method that are hasNext()
, next()
and remove()
.
This means that we can remove any element from a collection while iterating over it. so why we cannot add element to the collection. Why they don’t provide add()
method.
Answer is, that they can’t allow you to concurrently read and add element to a collection. The Iterator work on any collection whether it Set, List or Map. So it does know very much the on which underlying it’s going to work and we know all the collection implementation maintain ordering of elements based on some algorithm. For example TreeSet
maintains the order of elements in by implementation Red-Black Tree data structure. Therefore if we tried to add an element to TreeSet
using the iterator at given index or position of iterator. it might corrupt the state of the underlying data structure. So, the add()
method could change structural state of a data structure.
This is a very simple login demo web-app in struts 1.3 which support Internationalization and Localization (or a multilingual application which in English, Hindi, German, French and Spanish ). So before going any forward I have something share few day before writing this post I attended an interview for Struts 1x I have around 2+ year of experience in struts 1 and then ask me how to handle Internationalization and Localization in struts. And I have never worked with multilingual application before but have some idea about multiple resource file ending with a locale so as I came back got some time wrote and demo for the multilingual app.
Parsing an XML Document with StAX parser which is one of the fastest way to parser document in current days. Having very less memory footprint, easy to implement then previous generation of parser like
DOM (Document Object Model) parse and others. This make StAX must use API for modern day application it is fast and lightweight. So, below we have a easy program to parse down an XML document using StAX.
StAX (Streaming API for XML) is an application programming interface (API) to read and write XML documents, originating from the Java programming language community. It is one most fastest API to parse an XML document and very lightweight too. StAX work’s on pull style of parsing unlike to SAX parser which is push style parsing.
Subscribe to this blog via RSS.
Java 14
Python 2
Ops 3
Shared 3
Angular 1
Web 1
Java (14) Python (2) Wordpress (1) Ops (3) Angular (1) Web (1)