Karthikeya Boyini has Published 2383 Articles

Add all the elements from a collection to the HashSet in Java

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:51:04

373 Views

First, set the collection −String strArr[] = { "P", "Q", "R", "S" };Now, take a Set and add all the elements of the above collection using asList() method −Set s = new HashSet(Arrays.asList(strArr));The following is an example to add all elements from a collection to the HashSet −Example Live Demoimport java.util.Arrays; ... Read More

Copy all elements of Java HashSet to an Object Array

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:49:16

236 Views

Declare a HashSet and add elements −Set hs = new HashSet(); hs.add(15); hs.add(71); hs.add(82); hs.add(89); hs.add(91); hs.add(93); hs.add(97); hs.add(99);To copy all the elements, use the toArray() method −Object[] obArr = hs.toArray();The following is an example to copy all elements to HashSet to an object array −Example Live Demoimport java.util.*; public class ... Read More

Iterate through elements of HashSet in Java

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:47:33

298 Views

Create a HashSet and add elements to it −Set hs = new HashSet(); hs.add(20); hs.add(39); hs.add(67); hs.add(79); hs.add(81); hs.add(87);Try the below given code to iterate through the elements −Iterator i = hs.iterator(); while (i.hasNext()) System.out.println(i.next());To iterate through the elements of HashSet, try the following code −Example Live Demoimport java.util.*; public class ... Read More

Iterate over the elements of HashSet in Java

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:45:39

197 Views

Declare a HashSet and add elements −Set hs = new HashSet(); hs.add(20); hs.add(39); hs.add(67); hs.add(79);Now, iterate over the elements −for (Iterator i = hs.iterator(); i.hasNext();) {    Object ele = i.next();    System.out.println(ele); }The following is an example that iterate over the elements of HashSet −Example Live Demoimport java.util.HashSet; import java.util.Iterator; ... Read More

How to preserve the readability when font fallback occurs with CSS

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:36:34

81 Views

Use the font-size-adjust property to preserve the readability when font fallback occurs. You can try to run the following code to implement the font-size-adjust propertyExampleLive Demo                    #demo {             font-size-adjust: 0.90;          }                     Heading Two       With font-size-adjust property:                This is demo text.             Without font-size-adjust property:       This is demo text.    

Set the size of the gap between CSS grid columns

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 08:50:18

102 Views

Use the grid-column-gap property to set the size of the gap between grid columns in CSSExampleLive Demo                    .container {             display: grid;             grid-auto-rows: 50px;             grid-column-gap: 30px;             grid-row-gap: 20px;             background-color: #2E86C1;             padding: 10px;          }          .container>div {             background-color: #F2D7D5;             text-align: center;             padding:10px 0;             font-size: 20px;          }          .ele3 {             grid-column-end: span 2;          }                              1          2          3          4          5          6          

CSS all Property

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 08:22:07

178 Views

Use the all property to reset all the properties. Set all property to initial, inherit or unset.You can try to run the following code to implement the CSS all propertyExampleLive Demo                    html {             color: blue;          }          #demo {             background-color: yellow;             color: red;             all: inherit;          }                     CSS all property       This is demo text.    

Perform Animation on CSS border-bottom-left-radius property

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 07:39:14

88 Views

To implement animation on the border-bottom-left-radius property with CSS, you can try to run the following codeExampleLive Demo                    div {             width: 500px;             height: 400px;       ... Read More

Usage of linear-gradient() CSS function

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 07:27:12

70 Views

Set a linear gradient as the background image, with linear-gradient() CSS function. You can try to run the following code to implement linear-gradient() function in CSSExampleLive Demo                    #demo {             height: 200px;             background: linear-gradient(green, orange, maroon);          }                     Setting background as linear gradient.          

DOMException Failed to load because no supported source was found

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 07:26:12

2K+ Views

It can be a Cross-Origin Resource Sharing (CORS) issue.video.crossOrigin = 'anonymous';To enable cross-origin resource sharing, use the following. It allows the images to pass the HTTP header with an image response.Access-Control-Allow-Origin: *You can also use the HTML() method −$('#audio').html('');

Advertisements