<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: krishnarao inturi</title>
    <description>The latest articles on DEV Community by krishnarao inturi (@krishnaraointuri).</description>
    <link>https://dev.to/krishnaraointuri</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1279951%2F2c397203-5eb4-4ffc-a262-752f396fb269.jpeg</url>
      <title>DEV Community: krishnarao inturi</title>
      <link>https://dev.to/krishnaraointuri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krishnaraointuri"/>
    <language>en</language>
    <item>
      <title>Data Structures</title>
      <dc:creator>krishnarao inturi</dc:creator>
      <pubDate>Fri, 16 Feb 2024 15:40:20 +0000</pubDate>
      <link>https://dev.to/krishnaraointuri/data-structures-1df</link>
      <guid>https://dev.to/krishnaraointuri/data-structures-1df</guid>
      <description>&lt;p&gt;In Java, a data structure refers to a way of organizing and storing data in a computer so that it can be accessed and manipulated efficiently. It defines the relationship between the data elements, operations that can be performed on the data, and the rules or constraints for accessing and modifying the data.&lt;/p&gt;

&lt;p&gt;Some of the commonly used data structures include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.ArrayList&lt;/strong&gt;: It is a resizable array implementation of the List interface. It allows fast random access to elements and dynamic resizing of the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.ArrayList;

ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;&amp;gt;();
list.add(10);
list.add(20);
System.out.println(list.get(0)); // Output: 10

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2.LinkedList&lt;/strong&gt;: It is a doubly-linked list implementation of the List interface. It provides fast insertion and deletion operations but slower random access.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.LinkedList;

LinkedList&amp;lt;String&amp;gt; linkedList = new LinkedList&amp;lt;&amp;gt;();
linkedList.add("Apple");
linkedList.add("Banana");
System.out.println(linkedList.getFirst()); // Output: Apple

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3.HashMap&lt;/strong&gt;: It stores key-value pairs and provides constant-time performance for the basic operations like get() and put(). It does not maintain order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.HashMap;

HashMap&amp;lt;String, Integer&amp;gt; map = new HashMap&amp;lt;&amp;gt;();
map.put("John", 25);
map.put("Alice", 30);
System.out.println(map.get("John")); // Output: 25

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4.HashSet&lt;/strong&gt;: It is an implementation of the Set interface. It stores unique elements and does not maintain any order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.HashSet;

HashSet&amp;lt;String&amp;gt; set = new HashSet&amp;lt;&amp;gt;();
set.add("Apple");
set.add("Banana");
System.out.println(set.contains("Apple")); // Output: true

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5.Stack&lt;/strong&gt;: It is a Last-In-First-Out (LIFO) data structure. It extends Vector with five operations that allow a vector to be treated as a stack.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.Stack;

Stack&amp;lt;Integer&amp;gt; stack = new Stack&amp;lt;&amp;gt;();
stack.push(10);
stack.push(20);
System.out.println(stack.pop()); // Output: 20

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6.Queue&lt;/strong&gt;: It is a First-In-First-Out (FIFO) data structure. LinkedList class implements this interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.Queue;
import java.util.LinkedList;

Queue&amp;lt;Integer&amp;gt; queue = new LinkedList&amp;lt;&amp;gt;();
queue.add(10);
queue.add(20);
System.out.println(queue.poll()); // Output: 10

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are just a few examples of the built-in data structures available in Java. Depending on your requirements, you can choose the appropriate data structure to efficiently manage your data.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
