In this post under Java Collections, I will show with example how to obtain an immutable map. Below is the complete main code for your reference Main class 1 package core.collection; 2 3 import java.util.Collections; 4 import java.util.HashMap; 5 import java.util.Map; 6 7 public class ImmutableMapDemo { 8 public static void main(String[] args) { 9…… Continue reading Converting a map to immutable map
Tag: Java
Converting a collection to immutable collection
In this post under Java Collections, I will show with example how to create immutable collections. Below is the complete code for your reference. Main class 1 package core.collection; 2 3 import java.util.ArrayList; 4 import java.util.Collection; 5 import java.util.Collections; 6 import java.util.List; 7 8 public class ImmutableCollectionDemo { 9 public static void main(String args [])…… Continue reading Converting a collection to immutable collection
Creating a synchronized map
In this post under Java Collections, I will explain with example how to create synchronized map. Below is the complete code for your reference Main class 1 package core.collection; 2 3 import java.util.Collections; 4 import java.util.HashMap; 5 import java.util.Map; 6 7 public class SyncMapDemo { 8 public static void main(String args []) { 9 Map<Integer,…… Continue reading Creating a synchronized map
Creating a synchronized collection
In this post under Java Collections, I will show with example how to create a synchronized collection. Below is the complete main code for your reference. 1 package core.collection; 2 3 import java.util.ArrayList; 4 import java.util.Collection; 5 import java.util.Collections; 6 import java.util.List; 7 8 public class SyncCollectionDemo { 9 public static void main(String[] args) {…… Continue reading Creating a synchronized collection
Collection to Enumeration conversion
In this post under Java Collections, I will show with example how to convert a collection to Enumeration. Below is the complete code for your reference. Main class 1 package core.collection; 2 3 import java.util.Collections; 4 import java.util.Enumeration; 5 import java.util.List; 6 import java.util.ArrayList; 7 8 public class ColToEnumDemo { 9 public static void main(String…… Continue reading Collection to Enumeration conversion
Copying elements from one list to another list
In this post under Java Collections, I will show with example how to copy elements from one list to another. Below is the complete code for your reference. Main class 1 package core.collection; 2 3 import java.util.ArrayList; 4 import java.util.Collections; 5 import java.util.List; 6 7 public class ListCopyDemo { 8 public static void main(String []…… Continue reading Copying elements from one list to another list
Adding a new attribute for an ldap entry
In this post under Java LDAP, I will show with example how to add a new attribute to an existing ldap entry. For our example I will add a “telephoneNumber” attribute to an ldap entry identified by dn. I will show two approaches through which we can add a new attribute to an existing ldap…… Continue reading Adding a new attribute for an ldap entry
Modifying an existing attribute of a ldap entry
In this post under Java LDAP, I will show with example how to modify an existing attribute of an ldap entry. For our example I will modify the “description” attribute of an ldap entry identified by dn. I will show two approaches through which we can modify the attribute of an ldap entry. Below is…… Continue reading Modifying an existing attribute of a ldap entry
Deleting an LDAP entry
In this post under Java LDAP, I will explain how to delete an LDAP entry. The below figure shows the LDAP DIT (Directory Information Tree) I will show two approaches to delete an ldap entry or sub context. In the first approach we will delete the ldap entry with dn “cn=user3,ou=dev,dc=example,dc=org”. In the second approach…… Continue reading Deleting an LDAP entry
Creating a new entry in ldap
In this post under Java LDAP, I will show how to create a sub context with an example In LDAP, sub context means a new LDAP entry under another existing LDAP entry or context. Below is the screenshot of LDAP DIT (Directory Information Tree) I will show two approaches that can be used to create…… Continue reading Creating a new entry in ldap