- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Let’s say we have a String List with an empty value. Here, we have empty array elements before Football and after Squash:List sports = Arrays.asList("", "Football", "Cricket", "Tennis", "Squash", "", "Fencing", "Rugby");Now filter the empty string values. At first, we have used Predicate to negate values:Stream stream = sports.stream(); Predicate empty = String::isEmpty; Predicate emptyRev = empty.negate(); stream.filter(emptyRev).collect(Collectors.toList()));The following is an example to filter empty string values from a List:Exampleimport java.util.Arrays; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; public class Demo { public static void main(String[] args) { List sports = Arrays.asList("", "Football", "Cricket", "Tennis", ... Read More
In the Affine cipher, each letter in an alphabet is mapped to its numeric equivalent, is a type of monoalphabetic substitution cipher. Encryption is done using a simple mathematical function and converted back to a letter.The letters of an alphabet of size m are first mapped to the integers in the range 0 … m-1, in the Affine cipher, The ‘key’ for the Affine cipher consists of 2 numbers, a and b. a should be chosen to be relatively prime to m.EncryptionTo transform the integer, it uses modular arithmetic that each plaintext letter corresponds to into another integer that correspond ... Read More
Set the alignment of the label’s content along the Y axis on the bottom, use the setVerticalAlignment() method and set the location. Let us first set a label component. We have set the label background color as well so that we can check the alignment of the label’s content properly −JLabel label = new JLabel("Project Name"); label.setPreferredSize(new Dimension(190, 100)); label.setOpaque(true); label.setBackground(Color.GREEN); label.setForeground(Color.WHITE);Now, we will align the label content along the Y axis on the bottom by seeting location as BOTTOM −label.setVerticalAlignment(JLabel.BOTTOM);The following is an example to set the alignment of the label content along the Y axis in the bottom ... Read More
To check if table exists, use the following syntax −CREATE TABLE IF NOT EXISTS yourTableName ( yourColumnName1 dataType, . . . . N );Here, we will try to create a table that already exists and then it will produce a warning message “Table already exists”. Let us first create a table. This table already exists −mysql> CREATE TABLE IF NOT EXISTS DemoTable ( Id int ); Query OK, 0 rows affected, 1 warning (0.06 sec)The warning message is as follows −mysql> show warnings;Output+-------+------+-------------------------------------+ | Level | Code | Message ... Read More
The autofocus attribute of the element in HTML is used to set focus to a drop-down list when the page loads.Following is the syntax −Let us now see an example to implement the autofocus attribute of the element −Example Live Demo Profile Educational Qualification Graduation BCA B.COM B.TECH Postgraduation MCA M.COM M.TECH M.Sc Worked at ABC Corporation from July 2015 - May 2019 as a Technical Manager. ... Read More
The HTML DOM Link rel property sets/returns the relationship between the current and the linked document and is required to mention.SyntaxFollowing is the syntax −Returning rel attribute valuelinkObject.relSetting rel to a valueStringlinkObject.rel = valueStringValue StringsHere, “valueString” can be the following −valueStringDescriptionalternateIt providesauthorIt provides a link to the author of the linked documentdnsprefetchIt specifies that the browser should pre-emptively perform DNS resolution for the target resource's originhelpIt provides a link to a help document if anyiconIt imports an icon to represent the documentrelIt sets/returns the relationship between the current and the linked documentlicenseIt provides copyright information for the linked documentnextIt provides ... Read More
Here we will see how to initialize the const type variable using constructor?To initialize the const value using constructor, we have to use the initialize list. This initializer list is used to initialize the data member of a class. The list of members, that will be initialized, will be present after the constructor after colon. members will be separated using comma.Example#include using namespace std; class MyClass { private: const int x; public: MyClass(int a) : x(a) { //constructor } void show_x() { ... Read More
Kadane’s algorithm is used to find out the maximum subarray sum from an array of integers. Here we shall discuss a C++ program to implement this algorithm.AlgorithmBegin Function kadanes(int array[], int length): Initialize highestMax = 0 currentElementMax = 0 for i = 0 to length-1 currentElementMax = max(array[i], currentElementMax + array[i]) highestMax = max(highestMax, currentElementMax) return highestMax EndExample#include using namespace std; int kadanes(int array[], int length) { int highestMax = 0; int currentElementMax = 0; for(int i = 0; i < length; i++){ ... Read More
There are 4 ways to display the output in JavaScript. a) Displaying the output in HTML elements, using innerHTML attribute. Live DemoExample document.getElementById("display").innerHTML = 10 + 10; Output20.b) Displaying the output using document.write(). Live DemoExample document.write(2 + 3); Output5c) Displaying the output through console.log(). Live DemoExample console.log(2 + 3); In debugger console, the output5.d) Displaying the output through alert box. Live DemoExample alert(2 + 3); In alert window box, the output5In case of handling json strings, or some other big data console.log is the best choice.
Here we will see the concept of Bidirectional iterators in C++.The bidirectional iterators support all of the features of forward iterators, and also prefix and postfix decrement operators.This type of iterator can access elements in both directions, like towards the end and towards the beginning.The random access iterator is also a type of bidirectional iterator.Bidirectional iterators have features of forward iterator, but only difference is this iterator can also be decremented.The Bidirectional iterators has some properties. These are like below.PropertyExpressionThe bidirectional iterator is default-constructible, copy-assignable, and also destructibleA pA q(p) q = pWe can compare them using equality and inequality operatorsp ... Read More
To Continue Learning Please Login
Login with Google