Created
November 15, 2017 08:33
-
-
Save yukihirai0505/023ff92fea22138ea839b7e0ee00c15f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dtoSeqを5000で分割して、それぞれに別々のトークンを付与する | |
protected def mapToken[T](dtoSeq: Seq[InstagramDto[T]], tokens: Seq[String]): Seq[InstagramDto[T]] = { | |
dtoSeq.grouped(5000).toSeq.zipWithIndex.flatMap { | |
case (d, i) => d.map { s => | |
def getIndex(index: Int): Int = { | |
if (index < tokens.length) index | |
else getIndex(index - tokens.length) | |
} | |
s.copy(accessToken = Some(tokens(getIndex(i)))) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment