Merge "Update SIPHeaderList to inherit SequencedCollection added in OpenJDK 21" into main am: 640e83f19f am: 9f42d45bf1 Original change: https://android-review.googlesource.com/c/platform/external/nist-sip/+/2923598 Change-Id: Ib4346d3376a4881b07b50ca50eb13299c41e0942 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/java/gov/nist/javax/sip/header/SIPHeaderList.java b/java/gov/nist/javax/sip/header/SIPHeaderList.java index d11506a..f248303 100644 --- a/java/gov/nist/javax/sip/header/SIPHeaderList.java +++ b/java/gov/nist/javax/sip/header/SIPHeaderList.java
@@ -208,7 +208,7 @@ * * @return SIPHeader first element of the list. */ - public Header getFirst() { + public HDR getFirst() { if (hlist == null || hlist.isEmpty()) return null; else @@ -220,7 +220,7 @@ * * @return SIPHeader last element of the list. */ - public Header getLast() { + public HDR getLast() { if (hlist == null || hlist.isEmpty()) return null; return hlist.get(hlist.size() - 1); @@ -277,18 +277,21 @@ /** * Remove the first element of this list. */ - public void removeFirst() { - if (hlist.size() != 0) - hlist.remove(0); - + public HDR removeFirst() { + if (hlist.size() != 0) { + return hlist.remove(0); + } + return null; } /** * Remove the last element of this list. */ - public void removeLast() { - if (hlist.size() != 0) - hlist.remove(hlist.size() - 1); + public HDR removeLast() { + if (hlist.size() != 0) { + return hlist.remove(hlist.size() - 1); + } + return null; } /**