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).
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()`.