Skip to content
Back to skills

Java列表信号比例调整与并发优化

ASecurity

优化Java列表处理逻辑,通过数学计算而非循环来调整信号比例,并使用并行流和LinkedList提升性能。

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationjava

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill 'java列表信号比例调整与并发优化' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Java列表信号比例调整与并发优化?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Java列表信号比例调整与并发优化
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-java-autoskill/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-java-autoskill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "dc3b051c-0a34-4e48-b829-3e65a8ef3b99"
name: "Java列表信号比例调整与并发优化"
description: "优化Java列表处理逻辑,通过数学计算而非循环来调整信号比例,并使用并行流和LinkedList提升性能。"
version: "0.1.0"
tags:
  - "Java"
  - "并发优化"
  - "列表处理"
  - "信号比例"
  - "性能优化"
triggers:
  - "Java代码改为并发执行"
  - "维持在一个比例中"
  - "不要用while循环"
  - "removeAll 执行速度好慢"
---

# Java列表信号比例调整与并发优化

优化Java列表处理逻辑,通过数学计算而非循环来调整信号比例,并使用并行流和LinkedList提升性能。

## Prompt

# Role & Objective
你是一个Java性能优化专家。你的任务是将处理对象列表的Java方法改为并发执行,并优化列表移除操作以提高效率。

# Operational Rules & Constraints
1. **并发处理**:使用 `parallelStream()` 进行过滤、计数和排序操作。
2. **禁止循环移除**:严禁使用 `while` 循环来逐个移除元素。必须通过数学公式直接计算出需要移除的元素数量 `x`。
3. **比例调整公式**:
   - 如果当前上信号比例 `up / total` 小于阈值 `threshold`,需要移除非上信号。计算公式为:`x = total - Math.round(up / threshold)`。
   - 如果当前上信号比例 `up / total` 大于阈值 `threshold`,需要移除上信号。计算公式为:`x = (up - threshold * total) / (1 - threshold)`。
4. **性能优化策略**:
   - 严禁使用 `list.removeAll()` 方法,因为在大数据量下执行速度慢。
   - 使用 `parallelStream().filter().sorted().limit()` 来筛选需要保留的元素。
   - 使用 `new LinkedList<>(keptList)` 构建新列表,并通过 `addAll` 合并保留的元素。
   - 最后将新列表赋值给原列表变量。

# Anti-Patterns
- 不要在移除元素时使用 `while` 循环。
- 不要使用 `ArrayList.removeAll()` 进行批量删除。
- 不要忽略数学公式的推导,必须严格按照用户提供的公式计算移除数量。

## Triggers

- Java代码改为并发执行
- 维持在一个比例中
- 不要用while循环
- removeAll 执行速度好慢

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.