title: Does Java have an StringStream equivalent?
body: <p>So I am trying to get back into Java after doing C++ for quite some time, I decided to practice by rewriting my C++ programs into Java. Now in my Min Max Program I have the following lines of code:</p>
  
  <pre><code>  //C++ Code Sample
    getline(cin,mystr);
    stringstream(mystr) &gt;&gt; value;
  
    max = value;
    min = value;
  
    stringstream stream(mystr);
  
        while(stream &gt;&gt; value)
        {
          if(value &gt; max)
          {
            max = value;
          }
          else if(value &lt; min)
          {
            min = value;
          }
        }
  </code></pre>
  
  <p>Now, getline is equivalent to using the Scanner class, but what of the StringStream? While searching I saw people mentioning InputStream, but that seems to be related to reading from a file, ex: <a href="http://www.tutorialspoint.com/java/io/inputstream_read.htm" rel="noreferrer">http://www.tutorialspoint.com/java/io/inputstream_read.htm</a>. </p>
  
  <p>Thus, I was wondering if I can get similar functionality? I could of course also ask the user to specify how many inputs they wish to type in, and then just populate an array; but that seems awkward. </p>
  
  <p>Update:</p>
  
  <p>I created a quick work around that works as follows: </p>
  
  <pre><code>  String in = "";
  
              while(true)
              {
  
                  in = input.nextLine();
                  if(in.equalsIgnoreCase("DONE"))
                  {
                      break;
                  }
                  value = Integer.parseInt(in);
  
                  if(value &gt; max)
                  {
                      max = value;
                  }
                  else if(value &lt; min)
                  {
                      min = value;
                  }
              }
  </code></pre>