*/
public MRConsumer build ()
{
- if ( fHosts == null || fHosts.size() == 0 || fTopic == null )
+ if ( fHosts == null || fHosts.isEmpty() || fTopic == null )
{
throw new IllegalArgumentException ( "You must provide at least one host and a topic name." );
}
*/
public PublisherBuilder usingHosts ( String[] hostSet )
{
- final TreeSet<String> hosts = new TreeSet<String> ();
+ final TreeSet<String> hosts = new TreeSet<> ();
for ( String hp : hostSet )
{
hosts.add ( hp );
if (a == null)
return null;
- final TreeSet<String> set = new TreeSet<String>();
+ final TreeSet<String> set = new TreeSet<>();
for (int i = 0; i < a.length(); i++) {
set.add(a.getString(i));
}
*/
public static List<HttpHost> createHostsList(Collection<String> hosts)
{
- final ArrayList<HttpHost> convertedHosts = new ArrayList<HttpHost> ();
+ final ArrayList<HttpHost> convertedHosts = new ArrayList<> ();
for ( String host : hosts )
{
if ( host.length () == 0 ) continue;
@Override
public MRConsumerResponse fetchWithReturnConsumerResponse(int timeoutMs, int limit) {
- final LinkedList<String> msgs = new LinkedList<String>();
+ final LinkedList<String> msgs = new LinkedList<>();
MRConsumerResponse mrConsumerResponse = new MRConsumerResponse();
try {
if (ProtocolTypeConstants.DME2.getValue().equalsIgnoreCase(protocolFlag)) {
@Override
public Set<String> getTopics () throws IOException
{
- final TreeSet<String> set = new TreeSet<String> ();
+ final TreeSet<String> set = new TreeSet<> ();
try
{
final JSONObject topicSet = get ( "/topics" );
Thread.sleep(2);
i++;
for (String msg : cc.fetch()) {
- // System.out.println ( "" + (++count) + ": " + msg );
+
System.out.println(msg);
}