1182 Views
Sorting is a way to arrange elements (objects) of a list or array in a certain order. The order may be in ascending or descending order. Another useful class in java.util package.   the java.util package is the Collections class, which include the sort() method for sorting lists alphabetically ...
Anamika Gupta
Dec 15, 2021
1128 Views
The size() method to define that how many times the loop should run. The looping through the principle of an ArrayList with a for loop public class Main {    public static void main(String[] args) {      ArrayList<String> mobiles = new ArrayList<String>();     mobiles.add("Samsung");   ...
Anamika Gupta
Dec 15, 2021
1165 Views
To delete an element, use the remove() method and refer to the index number: import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<String> mobiles = new ArrayList<String>(); mobiles.add("Samsung"); mobiles.add("Apple"); ...
Anamika Gupta
Dec 14, 2021
1101 Views
By using the get() method we can access an element in the ArrayList, which is assigned to the index number: import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<String> mobiles = new ArrayList<String>(); mobiles.add("Samsung"); ...
Anamika Gupta
Dec 14, 2021
1033 Views
In java.util package the ArrayList class is found which is used to resize Array. The main difference between an ArrayList and a built-in array in Java is that the syntax is also slightly different and the size of the array cannot be modified. Whenever you want to you can add and remove elements from ...
Anamika Gupta
Dec 14, 2021
2174 Views
To calculate the length of any string or get the elements count of an Array or List, You can use len() function in Python. 1. Length of String name = "Sheetal Kumar" size = len(name) print(size) Output: 13   2. Length of List: items = ["A","B","C","D"] size = len(items) print(size) Output: 4   ...
Sheetal Kumar
Apr 24, 2019
11539 Views
In Python we use List in place of Array. The name is different but the functionality of List is like an Array in any other language. To merge two arrays in python, you can use Concatenate Operator directly. finalList = listA + listB Full Example: listA = ["A", "B", "C"] listB = ["D", ...
Sheetal Kumar
Apr 24, 2019
7734 Views
Android Alert Dialog provides lots of option for customization. Such as we can create Confirm Dialog, Action Dialog, Custom View or Form in Dialog, List Selection in Alert Dialog. Here we will know about list selection in Android Alert Dialog. Step 1: Create a global variable for the list and ...
Sheetal Kumar
Aug 15, 2018
2702 Views
1. array_change_key_case :-  It changes all the keys of  an array in uppercase. <?php $employee_id=array("Jim"=>"40535","Krish"=>"83007","Joe"=>"41233"); print_r(array_change_key_case($employee_id,CASE_UPPER)); ?> Output Array ( [JIM] => 40535 [KRISH] ...
Anamika Gupta
Jul 23, 2018
3650 Views
The list of keyword in Python and their uses are as follows:-   False assert del for in or while None break elif from is pass with True class else global lambda raise yield and  continue except if nonlocal return   as def finally import not try     Some ...
Anamika Gupta
May 31, 2018
42871 Views
Implode and explode is the basic operation in any programming language. Here i will show you how to join and array or List items in single string or split sting into multiple variables or array in python. Sometimes you may need to break a large string down into smaller parts or strings.  ...
Sheetal Kumar
Feb 08, 2018
2552 Views
The list is the most useful data collection in python. It acts like an Array and has associated functions to perform multiple operations in the List in Python. Here we will elaborate the functionality and uses of List. Let's start with an empty list creation and add String and Dictionary ...
Sheetal Kumar
Feb 04, 2018
Page 1 of 1 Pages       Total Records 12
  • First
  • Prev
  • 1
  • Next
  • Last