title: How do I check see a newline character with my scanner if I'm using a delimiter?
body: <p>I'm trying to make an undirected graph with some of the nodes (not all, unlike my example) being connected to one another.  So my input format will look like </p>
  
  <pre><code>3
  1:2,3
  2:1,3
  3:1,2
  </code></pre>
  
  <p>Meaning there's three nodes in all, and 1 is connected to 2 and 3, 2 is connected to 1 and 3 and so on.</p>
  
  <p>However, I cannot understand how to take the input in a meaningful way.  Here's what I've got so far.</p>
  
  <pre><code>public Graph createGraph() {
      Scanner scan = new Scanner(System.in).useDelimiter("[:|,|\\n]");
      int graphSize = scan.nextInt();
      System.out.println(graphSize);
      for (int i = 0; i &lt; graphSize; i++) {
          while (!scan.hasNext("\\n")) {
              System.out.println("Scanned: " + scan.nextInt());
          }
      }
      return new Graph(graphSize);
  
  }
  </code></pre>
  
  <p>Can my</p>
  
  <pre><code>while (!scan.hasNext("\\n")) 
  </code></pre>
  
  <p>see the newline character when I'm using a delimiter on it?</p>