summaryrefslogtreecommitdiffstats
path: root/bundle-plugin/src/main/scala/com/yahoo/container/plugin/util/Iteration.scala
blob: ec16ce712e67312309c3e5100d2f26769ab43c55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.util

 /**
 * @author  tonytv
 */
object Iteration {
  def toStream[T](enumeration: java.util.Enumeration[T]): Stream[T] = {
    if (enumeration.hasMoreElements)
      Stream.cons(enumeration.nextElement(), toStream(enumeration))
    else
      Stream.Empty
  }
}