Skip to content

Commit

Permalink
Remove call to last and use lastOption on collection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Petesta committed Jan 8, 2017
1 parent 64d5492 commit 78b3beb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/scala/com/netaporter/uri/Uri.scala
Expand Up @@ -33,9 +33,13 @@ case class Uri (
pathPartOption(name).head

def matrixParams =
pathParts.last match {
case MatrixParams(_, p) => p
case _ => Seq.empty
pathParts.lastOption match {
case Some(pathPart) =>
pathPart match {
case MatrixParams(_, p) => p
case _ => Seq.empty
}
case None => Seq.empty
}

def addMatrixParam(pp: String, k: String, v: String) = copy (
Expand Down

0 comments on commit 78b3beb

Please sign in to comment.