---
Product: Aspose.Slides
Platform: java
Page Type: reference
Canonical URL: https://reference.aspose.org/slides/java/CommentCollection
---

# CommentCollection

## Overview

`CommentCollection` is a class in Aspose.Slides FOSS for Java.
Inherits from: `ICommentCollection`.

Represents a collection of comments of one author.

This class provides 20 methods for working with CommentCollection objects in Java programs.
Available methods include: `CommentCollection`, `addComment`, `asICollection`, `asIEnumerable`, `buildComment`, `clear`, `collectMyComments`, `findCommentByIdx`, `get`, `getAllCommentsParts`, `getAuthorObj`, `getOrCreateCommentsPart`, and 7 additional methods.
All public members are accessible to any Java application after installing the Aspose.Slides FOSS for Java package.
Properties: `allCommentsParts`, `authorObj`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `authorObj` | `ICommentAuthor` | Read | Resolves the owning {@link ICommentAuthor} object from the backing author data. |
| `allCommentsParts` | `List` | Read | Returns all {@link CommentsPart} instances across all slides that contain
 comments by this author. |

## Methods

| Signature | Description |
|-----------|-------------|
| `CommentCollection(author: ICommentAuthor)` | Creates a comment collection for the given author. |
| `initInternal(authorData: AuthorData, authorsPart: CommentAuthorsPart, pkg: OpcPackage, presentation: Presentation)` | Initializes this collection with package-level backing data. |
| `resolveSlide(partName: String)` → `ISlide` | Returns the {@link ISlide} whose part name matches the given part name, or {@code null}. |
| `getAuthorObj()` → `ICommentAuthor` | Resolves the owning {@link ICommentAuthor} object from the backing author data. |
| `getAllCommentsParts()` → `List` | Returns all {@link CommentsPart} instances across all slides that contain
 comments by this author. |
| `getOrCreateCommentsPart(slidePartName: String)` → `CommentsPart` | Gets or creates the {@link CommentsPart} for the given slide part name. |
| `buildComment(data: CommentData, cp: CommentsPart, slideObj: ISlide)` → `Comment` | Builds a {@link Comment} from raw comment data, a comments part, and an optional slide. |
| `collectMyComments()` → `List` | Collects all comments by this author across all slides in the package. |
| `addComment(text: String, slide: ISlide, position: PointF, createdTime: LocalDateTime)` → `IComment` | Adds a new comment with text, slide, position, and creation time, returning IComment |
| `insertComment(index: int, text: String, slide: ISlide, position: PointF, createdTime: LocalDateTime)` → `IComment` | Inserts a comment at the given index with specified details, returning IComment |
| `removeAt(index: int)` | Removes the comment at the specified index |
| `remove(comment: IComment)` | Deletes the specified IComment from the collection |
| `clear()` | Removes all comments from the collection |
| `get(index: int)` → `IComment` | Returns the IComment at the given index |
| `size()` → `int` | Returns the number of comments in the collection |
| `toArray()` → `IComment[]` | Returns a sub‑array of comments starting at startIndex with count elements |
| `toArray(startIndex: int, count: int)` → `IComment[]` |  |
| `asICollection()` → `List` | Returns the comments as a List |
| `asIEnumerable()` → `Iterable` | Returns the comments as an Iterable |
| `findCommentByIdx(idx: int)` → `Optional` | Returns an Optional containing the comment at the given index, if present |

## See Also

- [Aspose.Slides — Enterprise API Reference](https://reference.aspose.com/slides/)