Question: Am trying to get the difference between two files even though the file looks same it shows the difference that it has empty lines in the beginning 

How can I remove the empty lines before doing the difference 

I know sed -i '/^$/d should work but it didn't worked for me is there any other way 

Thanks

Answer: 
According to [Guava docs](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Iterators.html#forEnumeration(java.util.Enumeration)), you could use the `Iterators.forEnumeration()` method:

```
Enumeration<Something> enumeration = ...;

Iterator<SomeThing> iterator = Iterators.forEnumeration(enumeration);

```

And in [this question](https://stackoverflow.com/questions/24511052/java8-iterator-to-stream), it is explained how to get a stream from an iterator:

```
Stream<Something> stream = StreamSupport.stream(
    Spliterators.spliteratorUnknownSize(
        iterator, Spliterator.ORDERED),
    false);

```
In my [StreamEx](https://github.com/amaembo/streamex) library there's simple method [`StreamEx.of(Enumeration)`](http://amaembo.github.io/streamex/javadoc/one/util/streamex/StreamEx.html#of-java.util.Enumeration-) which does the job:

```
Stream<String> stream = StreamEx.of(enumeration);

```

Note that it not just a shortcut to the @Holger solution, but implemented in different manner. In particular, it has significantly better parallel execution characteristics compared to solutions involving `Spliterators.spliteratorUnknownSize()`.