Mahesh Parahar has Published 191 Articles

Difference between Paging and Segmentation

Mahesh Parahar

Mahesh Parahar

Updated on 13-Sep-2023 15:44:24

36K+ Views

PagingPaging is a memory management technique in which process address space is broken into blocks of the same size called pages (size is power of 2, between 512 bytes and 8192 bytes). The size of the process is measured in the number of pages. Similarly, main memory is divided into ... Read More

Difference between MAC Address and IP Address

Mahesh Parahar

Mahesh Parahar

Updated on 19-Aug-2022 12:38:43

10K+ Views

Both MAC Address and IP Address are used to uniquely identify a machine on the internet. MAC address is provided by the chip maker while IP Address is provided by the Internet Service Provider. Mac Address Media Access Control (MAC) address is a physical address that works at the data ... Read More

Difference between DNS and DHCP

Mahesh Parahar

Mahesh Parahar

Updated on 16-Jun-2022 12:23:23

12K+ Views

A Domain Name System (DNS) server is used to translate domain names to IP Addresses and vice versa. DHCP is a client/server protocol that automatically assigns an IP address and other configuration information to an Internet Protocol (IP) host.Read through this article to find out more about DNS and DHCP ... Read More

How to iterate List using Iterator in Java?

Mahesh Parahar

Mahesh Parahar

Updated on 26-May-2022 13:22:29

622 Views

The List interface extends the Collection interface. It is a collection that stores a sequence of elements. ArrayList is the most popular implementation of the List interface. The user of a list has quite precise control over where an element to be inserted in the List. These elements are accessible ... Read More

How to iterate a Java List using Iterator?

Mahesh Parahar

Mahesh Parahar

Updated on 26-May-2022 13:21:06

509 Views

The List interface extends the Collection interface and is an important member of Java Collections Framework. List interface declares the behavior of a collection that stores a sequence of elements. The most popular implementation of List interface is ArrayList. User of a list has quite precise control over where an ... Read More

How does a list work in Java?

Mahesh Parahar

Mahesh Parahar

Updated on 10-May-2022 08:42:04

206 Views

public interface List extends CollectionThe List interface extends Collection and declares the behavior of a collection that stores a sequence of elements.Elements can be inserted or accessed by their position in the list, using a zero-based index.A list may contain duplicate elements.In addition to the methods defined by Collection, List ... Read More

How do you create a list in Java?

Mahesh Parahar

Mahesh Parahar

Updated on 10-May-2022 07:58:41

8K+ Views

A List of elements can be created using multiple ways.Way #1Create a List without specifying the type of elements it can holds. Compiler will throw warning message for it.List list = new ArrayList();Create a List and specify the type of elements it can holds.Way #2List list = new ArrayList();Way #3Create ... Read More

How do you create a list from a set in Java?

Mahesh Parahar

Mahesh Parahar

Updated on 10-May-2022 07:55:19

283 Views

We can create a list from a set using its constructor.List list = new ArrayList(set);ExampleFollowing is the example showing the conversion of set to list −package com.tutorialspoint; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class CollectionsDemo {    public static void main(String[] args) {     ... Read More

How do you copy an element from one list to another in Java?

Mahesh Parahar

Mahesh Parahar

Updated on 10-May-2022 07:52:50

816 Views

An element can be copied to another List using streams easily.Use Streams to copy selective elements.List copyOfList = list.stream().filter(i -> i % 2 == 0).collect(Collectors.toList());ExampleFollowing is the example to copy only even numbers from a list −package com.tutorialspoint; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class CollectionsDemo { ... Read More

How do you check if an element is present in a list in Java?

Mahesh Parahar

Mahesh Parahar

Updated on 10-May-2022 07:40:10

6K+ Views

Elements can be checked from a list using indexOf() or contains() methods.Syntax - indexOf() methodint indexOf(Object o)Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ... Read More

Advertisements