What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-02-15 13:25:12
8.3.1. Common Array Methods // splice Examples (.splice)
//The general syntax for this method is: arrayName.splice(index, number of elements to change, item1, item2, ...); //Inside the parentheses (), only the first argument is required. /*The splice method modifies one or more elements anywhere in the array.... Add solution -
Javascript 2022-02-07 07:45:01
splice
//we can add elements to array using splice const strings=['a','b','c','d'] //go the 2nd index,remove 0 elements and then add 'alien' to it strings.splice(2,0,'alien') console.log(strings) //["a", "b", "alien", "c&quo... Add solution -
Other 2022-01-31 03:25:11
collection coding interview questions
import java.util.*; public class ArrayListContainsExample { public static void main(String args[]) { // initialize ArrayList ArrayList<Integer> al = new ArrayList<Integer>(); // add elements to ArrayList object ... Add solution -
Java 2022-01-28 03:56:14
java fill list
// -- Filling with fill() method example: List<String> arrlist = new ArrayList<String>(); //Add elements in the list arrlist.add("one"); arrlist.add("two"); arrlist.add("three"); // contents of list: [AA... Add solution -
Java 2021-10-23 21:35:11
java insert element at position
package com.tutorialspoint; import java.util.ArrayList; public class ArrayListDemo { public static void main(String[] args) { // create an empty array list with an initial capacity ArrayList<Integer> arrlist = new ArrayList<Inte... Add solution -
Other 2021-09-10 05:03:01
linked list head and tail
import java.util.Iterator; // Custom Linked List class using Generics class List<T> implements Iterable<T> { Node<T> head, tail; // add new Element at tail of the linked list in O(1) public void add(T data) { Node<T>... Add solution