Role of Filter Method in JavaScript

Ankitha Reddy
Updated on 30-Jul-2019 22:30:21

295 Views

JavaScript array filter() method creates a new array with all elements that pass the test implemented by the provided function. The following are the parameters − callback − Function to test each element of the array. thisObject − Object to use as this when executing callback. You can try to run the following code to learn how to work with filter() method in JavaScript − Example Live Demo JavaScript Array filter Method ... Read More

What Does the Method add(E element) Do in Java

Nikitha N
Updated on 30-Jul-2019 22:30:21

482 Views

The add(E e) method of the java.util.ArrayList class appends the specified element E to the end of the list.Example:import java.util.ArrayList; public class ArrayListDemo {    public static void main(String[] args) {       ArrayList arrlist = new ArrayList(5);       arrlist.add(15);       arrlist.add(20);       arrlist.add(25);       for (Integer number : arrlist) {          System.out.println("Number = " + number);       }    } }Output:Number = 15 Number = 20 Number = 25

When to Use LinkedList Over ArrayList in Java

Paul Richard
Updated on 30-Jul-2019 22:30:21

3K+ Views

LinkedList should be used where modifications to a collection are frequent like addition/deletion operations. LinkedList is much faster as compare to ArrayList in such cases. In case of read-only collections or collections which are rarely modified, ArrayList is suitable.

Which One is Faster: Array or List in Java

Moumita
Updated on 30-Jul-2019 22:30:21

923 Views

The array is faster in case of access to an element while List is faster in case of adding/deleting an element from the collection.

Apply AUTO INCREMENT to a Column

George John
Updated on 30-Jul-2019 22:30:21

188 Views

AUTO_INCREMENT means that the column will get the value automatically. To illustrate it we have created a table ‘employees’ as follows − mysql> Show Create Table employees\G *************************** 1. row *************************** Table: employees Create Table: CREATE TABLE `employees` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(35) DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec) From the above result set, we can see that column id is given the auto-increment option. Now, when we will insert the value in Name ... Read More

Functions of Index Server in SAP HANA System

Anil SAP Gupta
Updated on 30-Jul-2019 22:30:21

556 Views

Index Server is heart of SAP HANA system and is responsible for processing all SQL statements sent to HANA database. This server contains SQL/MDX Processing engine that is responsible to process and analyze data in HANA db.Index Server also contains Persistence layer for scalability and restoration of the system. In case of system failure, power failure or database corruption, Persistence layer is responsible for the restoration of HANA system to last save point.When you are running complex and large calculations, and there is a system failure Persistence layer is used to ensure that transactions are either fully executed or complete ... Read More

What Does the Method addFirst(E e) Do in Java

V Jyothi
Updated on 30-Jul-2019 22:30:21

250 Views

The addFirst(E e) method of the class java.util.LinkedList inserts the specified element at the beginning of this list.Example:public class LinkedListDemo {    public static void main(String[] args) {       LinkedList list = new LinkedList();       list.add("Hello");       list.add(2);       list.add("Chocolate");       list.add("10");       System.out.println("LinkedList:" + list);       list.addFirst("Element");       System.out.println("LinkedList:" + list);    } }Output:LinkedList:[Hello, 2, Chocolate, 10] LinkedList:[Element, Hello, 2, Chocolate, 10]

Extend Multiple Python Classes in Inheritance

Rajendra Dharmkar
Updated on 30-Jul-2019 22:30:21

502 Views

As per Python documentation ‘super’ can help in extending multiple python classes in inheritance.  It returns a proxy object that delegates method calls to a parent or sibling class of type. This is useful for accessing inherited methods that have been overridden in a class. The search order is same as that used by  getattr() except that the type itself is skipped.In other words, a call to super returns a fake object which delegates attribute lookups to classes above you in the inheritance chain. Points to note:This does not work with old-style classes.You need to pass your own class and ... Read More

What Does the Method addLast(E e) Do in Java?

Sravani S
Updated on 30-Jul-2019 22:30:21

212 Views

The addLast(E e) method of the java.util.LinkedList class inserts the specified element at the end of this list.Example:import java.util.*; public class LinkedListDemo {    public static void main(String[] args) {       LinkedList list = new LinkedList();       list.add("Hello");       list.add(2);       list.add("Chocolate");       list.add("10");       System.out.println("LinkedList:" + list);       list.addLast("Element");       System.out.println("LinkedList:" + list);    } }Output:LinkedList:[Hello, 2, Chocolate, 10] LinkedList:[Hello, 2, Chocolate, 10, Element]

Returning an Array in Java

George John
Updated on 30-Jul-2019 22:30:21

255 Views

Yes, an array can be returned from a java function. See the example below − Example public class Tester { public static void main(String[] args) { int[] array = getData(); for(int i: array) { System.out.println(i); } } public static int[] getData() { int[] dataArray = {1, 2, 3, 4}; return dataArray; } } Output 1 2 3 4

Advertisements