title: How to read values from array list from another class and get output depending on user input?
body: <p>So, I'm trying to figure out how to get values of an array list from another class and print certain values depending on user input.</p>
  <p>For example, firstly a user is asked to provide a location, once they enter a location, it has to read the user input and output the results according to the location.<a href="https://i.stack.imgur.com/OsBef.png" rel="nofollow noreferrer">an image is provided about the output</a>.</p>
  <p>For some reason it doesn't output the correct values from array list.
  Could you please help me out?</p>
  <p>This is my code for reading values from array list.</p>
  <pre><code>    public class Program {
      ArrayList&lt;Properties&gt; property = Properties.getMelbnbProperty();
      int i = 1;
      for(i = 1; i &lt; (property.size());) {
          System.out.println(property.get(i));
          break;
      }
      
      ArrayList&lt;Properties&gt; output = Properties.getMelbnbProperty();
          if(Properties.getMelbnbProperty().contains(choice)) {
              output.addAll(Properties.getMelbnbProperty());
          }
      } }
  </code></pre>
  <p>This is my code for array list.</p>
  <pre><code>public class Properties {
  public static ArrayList&lt;Properties&gt; getMelbnbProperty() {
      // Below is an arraylist where I have stored the Melbnb data
                  ArrayList&lt;Properties&gt; property = new ArrayList&lt;Properties&gt;();
                  property.add(new Properties(&quot;Private room in the heart of Southbank&quot;));
                  property.add(new Properties(&quot;Spacious bedroom in a cosy apartment in South Yarra\n&quot;));
                  property.add(new Properties(&quot;Ensuite room with great views&quot;));
                  property.add(new Properties(&quot;Single room next to Carlton Gardens&quot;));
                  property.add(new Properties(&quot;Studio close to Melbourne CBD&quot;));
                  property.add(new Properties(&quot;1-bedroom CBD view suite near Melbourne Central and RMIT&quot;));
                  property.add(new Properties(&quot;Stylish two bedroom in CBD&quot;));
                  property.add(new Properties(&quot;Sky high studio with amazing views&quot;));
                  property.add(new Properties(&quot;Budget accommodation bunk beds&quot;));
                  property.add(new Properties(&quot;A beautiful room near Marvel Stadium&quot;)); 
                  
                  return property;
  }}
  </code></pre>