Skip to main content

Posts

CHEAT SHEET for java List interface, LinkedList and ArrayList

Consider Below points before choosing List concrete implementations for your use case:  ArrayList is a linear data structure and  re-sizable/dynamic array   Initial size can be given. and if not given the default size is 10   It is always good practice to give initial size and advised not to give very large number as size   Good programmers prefer ArrayList to LinkedList if retrieval operations is done more frequently than insertion and deletions of elements.   Better choose LinkedList if insertion and deletion operations are done frequently compared to retrieval operations.   Lists are not sorted. if required use Collections.sort() to sort   Collections.sort() uses optimized merge sort [tim sort] on ArrayList   However legacy merge sort also can be used using a switch. But it is going to be deprecated  in near future  The major difference between ArrayList and LinkedList is RandomAccess behavior...

Atomicity with Java Programming Language

 Atomicity with Java What is Atomicity Atomicity, in computer science, is considered to be a property [ALL-OR-NOTHING], that the state of a resource in an operation is not controlled by a different flow of execution at the same time [Even in time slicing operations] We know, Java is not pure object oriented programming language, due to primitive data types' design behavior. Most of the Java experts, while designing and developing applications thrives hard, to create, most secured applications considering " Atomicity in multi threaded application". Does Java language helps in developing Secured application..? The answer is no, Java programming language does not give secured applications at all, especially in multi threaded environment. As we know, Java supports 2 types of variables/data types.  Primitive data types User defined data types Primitive data types:       Java supports 8 different primitive data types. They are:   boolean    1 ...

File IO operations with java programming language

File Management in OS File management includes files and folders creation, copy and paste operations, reading the file and writing into files and deleting the files and folders  And also reading meta data about files and folders. It may include file free space, occupied space and read/write permissions etc. These above operations are considered as file management and managed by respective operating system. GUI that represents Windows File Manager File Management with Java  Though Java is platform independent, programming language depends on native file IO resources of operating system. This is possible with the Java API support. These API are categorized into 2 types. Readers and Writers: Readers and writers does the IO operations, character by character InputStream and OutputStream: Where as InputStream and OutputStream does IO operations byte by byte Below are simple Java programs that demonstrates different File IO operations. Program for creating directory package com.all...

Demonstration of Java NullPointerException

NullPointerException causes and reasons Since Java is object oriented programming language, every thing is considered to be an object. and there is always a scope of an object to be null or "No value".  Since Java supports primitive data types, Java is not considered to be pure Java object oriented programming language.   Few Notable points about NullPointerException NullPointerExceptions is unchecked exception Please read post  Exception handling and java keywords before reading this article Usually if program tries to fetch the value from reference and finds nothing as value, then program throws NullPointerException 'Zero' is not null And empty String is not considered to be null It is not the subclass of RuntimeException class Demo code that throws NullPointerException  package com.allabtjava.blog; public class DemoNullPointerException { class BeanDemo { String name; Integer ID; public String getName() { return name; } public void s...

Evolution of Java Programming Language

Evolution of Java: First of all, The Java programming language and it's tools that we currenly using is not what actually expected. This language started as a project to give solutions for embedded devices, mobile phones and other portable peripherals.  Initially, the Java was called Oak.  Why it is Oak first..? and Why it transformed to Java..? The team of five technocrats including Dr. James Gosling and also known as Dr. Java, together working on a project, which expected to give solutions on embedded devices, portable smart devices and TV Set top Boxes etc. at Sun Micro Systems.  In the process of achieving this solution, at their breaktime, team used to relax with a coffee by having a glimpse on a scenery of Oak tree next to their facility.  Once the project has come to conclusion and in the process of giving a title to it, they noticed the Oak trees [Always observing them in their break time], they named this programming language as Oak. Oak Logo Why it transfor...

Java programming language and IDEs

IDE: Integrated Development Environment Integrated development environment, in short IDE is a convenient environment to write, execute and  debug the code or programs on a single platform. IDEs support not only writing code smoothly but also provides a provision to write scripts, XML files, simple text files and build scripts like Ant, Maven are few among others. In short IDEs are development environments to execute complete development activities using one application. IDEs and Editors IDEs and Editors fulfills the same purpose. That is writing code. But IDEs are glued or closely works with respective programming language's compilers, runtime environments, profilers and other language specific tools to put developer in a comfortable zone.  Some of the features of IDE: Auto completion Syntax Highlighting Code debugger Profilers Multipage editors Auto completion: Auto completion feature suggests APIs [methods, classes and interfaces] and keywords etc as we start typing in the e...

Agile Methodology with SCRUM Framework Basics

Software development activities can be managed and taken care with different life cycle models. These life cycle models has became legacy since few years. Few of the available Software Development Life Cycle Models in short SDLC are Win-Win Model and Waterfall Model etc. These traditional models has different phases of development.           1. Requirements            2. Analysis            3. Design            4. Implementation            5. Test           6. Documentation  and 7. Maintenance  In SDLC, the above stages are freezed one after the other. If developer is in Design phase and realized that there could be a possibility of change in requirements, then it is not possible to go back one phase and fix in Requirement phase.  These scenarios and use cases has brough...