Skip to content

Commit c1061ca

Browse files
committed
add comment explaining the merge method
1 parent 045337a commit c1061ca

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sentry/src/main/java/io/sentry/featureflags/FeatureFlagBuffer.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@ public IFeatureFlagBuffer clone() {
9797
currentBuffer instanceof FeatureFlagBuffer ? (FeatureFlagBuffer) currentBuffer : null);
9898
}
9999

100+
/**
101+
* Iterates all incoming buffers from the end, always taking the latest item across all buffers,
102+
* until maxSize has been reached or no more items are available.
103+
*
104+
* <p>If a duplicate is found we skip it since we're iterating in reverse order and we already
105+
* have the latest entry.
106+
*
107+
* @param maxSize max number of feature flags
108+
* @param globalBuffer buffer from global scope
109+
* @param isolationBuffer buffer from isolation scope
110+
* @param currentBuffer buffer from current scope
111+
* @return merged buffer containing at most maxSize latest items from incoming buffers
112+
*/
100113
private static @NotNull IFeatureFlagBuffer merged(
101114
final int maxSize,
102115
final @Nullable FeatureFlagBuffer globalBuffer,

0 commit comments

Comments
 (0)