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: 
Why not using vanilla Java : 

```
Collections.list(enumeration).stream()...

```

However as mentionned by @MicahZoltu, the number of items in the enumeration has to be taken into account, as `Collections.list` will first iterate over the enumeration to copy the elements in an `ArrayList`. From there the regular `stream` method can be used. While this is usual for many collection stream operations, if the enumeration is too big (like infinite), this can cause problem because the enumeration has to be transformed in a list then the other approaches described here should be used instead.
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()`.