Check if One String is a Rotation of Another in Java

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

527 Views

To find weather a string is rotation of another, concat the first string to itself twice and find weatherExample Live Demopublic class Sample {    public static void main(String args[]){       String str1 = "gala";       String str2 = "alag";       String s3 = str1+str1;       if(s3.contains(str2)) {          System.out.println("str1 is rotation of str2");       } else {          System.out.println("str1 is not rotation of str2");       }    } }

Updating Configuration Property File in SAP HANA Remote Source

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

398 Views

Note that while modifying or creating the property configuration file, only the property which is different from default value needs to be set. The mistake in property configuration file may result in incorrect action or result of data source.

Role of Filter Method in JavaScript

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

270 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

450 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

898 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

175 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

525 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

224 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

481 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

Advertisements