org.apache.jmeter.protocol.http.parser

## Class URLCollection

- java.lang.Object
- - org.apache.jmeter.protocol.http.parser.URLCollection

- All Implemented Interfaces:
    java.lang.Iterable<java.net.URL>

      public class URLCollection
      extends java.lang.Object
      implements java.lang.Iterable<java.net.URL>

  Collection class designed for handling URLs

  Before a URL is added to the collection, it is wrapped in a URLString class. The iterator unwraps the URL before return.

  N.B. Designed for use by HTMLParser, so is not a full implementation - e.g. does not support remove()

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `URLCollection(java.util.Collection<URLString> c)` Creates a new URLCollection from an existing Collection

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(java.net.URL u)` Adds the URL to the Collection, first wrapping it in the URLString class
    `boolean` | `addURL(java.lang.String url, java.net.URL baseUrl)` Convenience method for adding URLs to the collection.
    `java.util.Iterator<java.net.URL>` | `iterator()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### URLCollection

          public URLCollection(java.util.Collection<URLString> c)

      Creates a new URLCollection from an existing Collection
      Parameters:
        `c` - collection to start with (Must not be `null`)

  - ### Method Detail

    - #### add

          public boolean add(java.net.URL u)

      Adds the URL to the Collection, first wrapping it in the URLString class
      Parameters:
        `u` - URL to add
      Returns:
        boolean condition returned by the add() method of the underlying collection

    - #### addURL

          public boolean addURL(java.lang.String url,
                                java.net.URL baseUrl)

      Convenience method for adding URLs to the collection. If the url parameter is `null`, empty or URL is malformed, nothing is done
      Parameters:
        `url` - String, may be null or empty
        `baseUrl` - base for `url` to add information, which might be missing in `url`
      Returns:
        boolean condition returned by the add() method of the underlying collection

    - #### iterator

          public java.util.Iterator<java.net.URL> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<java.net.URL>`

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.