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: 
In Java 9 it is possible to convert an `Enumeration` to a `Stream` with a one-liner:

```
Enumeration<String> en = ... ;
Stream<String> str = StreamSupport.stream(
    Spliterators.spliteratorUnknownSize(en.asIterator(), Spliterator.ORDERED),
    false
);

```

(Well, it's a rather long line.)

If you're not on Java 9, you can convert the `Enumeration` into an `Iterator` manually using the technique given in [Holger's answer](https://stackoverflow.com/a/33243700/1441122).
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);

```