本文整理匯總了Python中java.util.Collections.reverse方法的典型用法代碼示例。如果您正苦於以下問題:Python Collections.reverse方法的具體用法?Python Collections.reverse怎麽用?Python Collections.reverse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.Collections
的用法示例。
在下文中一共展示了Collections.reverse方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _GetCurrentASTPath
# 需要導入模塊: from java.util import Collections [as 別名]
# 或者: from java.util.Collections import reverse [as 別名]
def _GetCurrentASTPath(context, reverse=False):
'''
@return: ArrayList(SimpleNode)
'''
from org.python.pydev.parser.fastparser import FastParser
selection = _CreateSelection(context)
ret = FastParser.parseToKnowGloballyAccessiblePath(
context.getDocument(), selection.getStartLineIndex())
if reverse:
from java.util import Collections
Collections.reverse(ret)
return ret
示例2: extract_content_between_block_level_nodes
# 需要導入模塊: from java.util import Collections [as 別名]
# 或者: from java.util.Collections import reverse [as 別名]
def extract_content_between_block_level_nodes(self, doc):
"""
Shows how to extract the content between a paragraph and table using the ExtractContent method.
"""
startPara = doc.getLastSection().getChild(NodeType.PARAGRAPH, 2, True)
endTable = doc.getLastSection().getChild(NodeType.TABLE, 0, True)
# Extract the content between these nodes in the document. Include these markers in the extraction.
extractedNodes = self.extract_contents(startPara, endTable, True)
# Lets reverse the array to make inserting the content back into the document easier.
Collections.reverse(extractedNodes[::-1])
while (len(extractedNodes) > 0):
# Insert the last node from the reversed list
endTable.getParentNode().insertAfter(extractedNodes[0], endTable)
# Remove this node from the list after insertion.
del extractedNodes[0]
# Save the generated document to disk.
doc.save(self.dataDir + "TestFile.DuplicatedContent Out.doc")