private void addContainersToProto() { maybeInitBuilder(); builder.clearContainer(); if (null == containers) { return; } Iterable<PreemptionContainerProto> iterable = new Iterable<PreemptionContainerProto>() { @Override public Iterator<PreemptionContainerProto> iterator() { return new Iterator<PreemptionContainerProto>() { Iterator<PreemptionContainer> iter = containers.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public PreemptionContainerProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllContainer(iterable); }
private void addContainersToProto() { maybeInitBuilder(); builder.clearContainer(); if (null == containers) { return; } Iterable<PreemptionContainerProto> iterable = new Iterable<PreemptionContainerProto>() { @Override public Iterator<PreemptionContainerProto> iterator() { return new Iterator<PreemptionContainerProto>() { Iterator<PreemptionContainer> iter = containers.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public PreemptionContainerProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllContainer(iterable); }
private void addContainersToProto() { maybeInitBuilder(); builder.clearContainer(); if (null == containers) { return; } Iterable<PreemptionContainerProto> iterable = new Iterable<PreemptionContainerProto>() { @Override public Iterator<PreemptionContainerProto> iterator() { return new Iterator<PreemptionContainerProto>() { Iterator<PreemptionContainer> iter = containers.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public PreemptionContainerProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllContainer(iterable); }