From starting, Facebook has become a leader of all social media sites. Its basic function is to connect and share information between friends, families, organizations, business, etc. Apart from friend’s meeting place, Facebook has also developed into business to market themselves through collaboration with customers and self-promotion.Facebook is a strong business marketing hub for any big and small corporation – A great place to keep customers up-to-date with the market and also develops their brand and expands their reach.In this post, we will show you how Facebook is helpful for business marketing, Play with Your Facebook Business PageFacebook is a ... Read More
Now, social media marketing has become a hope for everyone who use it either for; entertainment, sharing photos, videos or messages, or for business point of view.Earlier, it was collaborated between marketing and consumers, but now, it has become a main resource of B2B.It is good to hear that huge number of people is interested in social media, also it is good to hear that, how many brands and organizations are interested in social media and how those brands and organizations are taking benefit of people who every time use social media for their stuffs.Everything is good in social media, ... Read More
The List provides two methods to convert a List into Array.Way #1Object[] toArray()Returns an array containing all of the elements in this list in proper sequence (from first to last element).Way #2 T[] toArray(T[] a)Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.Type ParameterT − ... Read More
An ArrayList provides two methods to convert it into Array.Way #1Object[] toArray()Returns an array containing all of the elements in this list in proper sequence (from first to last element).Way #2 T[] toArray(T[] a)Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.Type ParameterT − The ... Read More
A list can be converted to a set object using Set constructor. The resultant set will elliminate any duplicate entry present in the list and will contains only the unique values.Set set = new HashSet(list);On similar pattern, we can get a list from a set using its constructor.List list = new ArrayList(set);ExampleFollowing is the example showing the conversion of list to set and set to list −package com.tutorialspoint; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; public class CollectionsDemo { public static void main(String[] args) { List list = new ArrayList(Arrays.asList(1, 2, ... Read More
The List provides two methods to convert a List into Array.1. Use toArray() method without parameter.Object[] toArray()ReturnsAn array containing all of the elements in this list in proper sequence.2. Use toArray() with array. T[] toArray(T[] a)Type ParameterT − The runtime type of the array.Parametersa − The array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.ReturnsAn array containing the elements of this list.ThrowsArrayStoreException − If the runtime type of the specified array is not a supertype of the runtime type ... Read More
A list can be converted to a set object using Set constructor. The resultant set will elliminate any duplicate entry present in the list and will contains only the unique values.Set set = new HashSet(list);Or we can use set.addAll() method to add all the elements of the list to the set.set.addAll(list);Using streams as well, we can get a set from a list.set = list.stream().collect(Collectors.toSet());ExampleFollowing is the example showing the list to set conversion via multiple ways −package com.tutorialspoint; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; public class CollectionsDemo { public static void ... Read More
The List provides two methods to convert a List into Array.1. Use toArray() method without parameter.Object[] toArray()ReturnsAn array containing all of the elements in this list in proper sequence.2. Use toArray() with array. T[] toArray(T[] a)Parametersa − The array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.ReturnsAn array containing the elements of this list.ThrowsArrayStoreException − If the runtime type of the specified array is not a supertype of the runtime type of every element in this list.NullPointerException − If ... Read More
List provides a method size() to check the current size of the list.Syntaxint size()Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.ReturnsThe number of elements in this list.ExampleThe following example shows how to get size of a list using size() method.package com.tutorialspoint; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class CollectionsDemo { public static void main(String[] args) { List list = new ArrayList(Arrays.asList(1, 2, 3, 4)); System.out.println("List: " + list); System.out.println("List Size: " + list.size()); list.add(5); ... Read More
List provides a method contains() to check if list contains that element or not. It utilizes equals() method so we need to override the equals() method in the element type.Syntaxboolean contains(Object o)Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).Parameterso − Element whose presence in this list is to be tested.ReturnsTrue if this list contains the specified element.ThrowsClassCastException − If the type of the specified element is incompatible with this list (optional).NullPointerException − If the specified element ... Read More